Re: [Updated PATCH] Re: crash while dissolving tabular

2007-07-21 Thread Angus Leeming

Abdelrazak Younes wrote:

@@ -32,16 +32,24 @@
 {
 // try to get the current cell
 BufferView const * const bv = kernel().bufferview();
+InsetTabular const * current_inset = 0;
 if (bv) {
 Cursor const & cur = bv->cursor();
 // get the innermost tabular inset;
 // assume that it is "ours"
 for (int i = cur.depth() - 1; i >= 0; --i)
 if (cur[i].inset().lyxCode() == Inset::TABULAR_CODE) {
+current_inset = static_cast*>(&cur[i].inset());

 active_cell_ = cur[i].idx();
 break;


Glad to here that this fixes the crash. However, the above should be 
const_cast<>.


Actually I don't need to modify the data, I just forgot the const. I 
committed this:


- current_inset = static_cast(&cur[i].inset());
+ current_inset = static_cast(&cur[i].inset());


This should be dynamic_cast followed by assert that the pointer isn't 
null...




Re: [Updated PATCH] Re: crash while dissolving tabular

2007-07-18 Thread Abdelrazak Younes

Angus Leeming wrote:

Abdelrazak Younes wrote:

I got a much better solution attached.

Abdel.




Index: frontends/controllers/ControlTabular.cpp
===
--- frontends/controllers/ControlTabular.cpp(revision 19100)
+++ frontends/controllers/ControlTabular.cpp(working copy)
@@ -32,16 +32,24 @@
 {
 // try to get the current cell
 BufferView const * const bv = kernel().bufferview();
+InsetTabular const * current_inset = 0;
 if (bv) {
 Cursor const & cur = bv->cursor();
 // get the innermost tabular inset;
 // assume that it is "ours"
 for (int i = cur.depth() - 1; i >= 0; --i)
 if (cur[i].inset().lyxCode() == Inset::TABULAR_CODE) {
+current_inset = static_cast*>(&cur[i].inset());

 active_cell_ = cur[i].idx();
 break;


Glad to here that this fixes the crash. However, the above should be 
const_cast<>.


Actually I don't need to modify the data, I just forgot the const. I 
committed this:


- current_inset = static_cast(&cur[i].inset());
+ current_inset = static_cast(&cur[i].inset());

Thanks,
Abdel.



Re: [Updated PATCH] Re: crash while dissolving tabular

2007-07-18 Thread Angus Leeming

Abdelrazak Younes wrote:

I got a much better solution attached.

Abdel.




Index: frontends/controllers/ControlTabular.cpp
===
--- frontends/controllers/ControlTabular.cpp(revision 19100)
+++ frontends/controllers/ControlTabular.cpp(working copy)
@@ -32,16 +32,24 @@
 {
// try to get the current cell
BufferView const * const bv = kernel().bufferview();
+   InsetTabular const * current_inset = 0;
if (bv) {
Cursor const & cur = bv->cursor();
// get the innermost tabular inset;
// assume that it is "ours"
for (int i = cur.depth() - 1; i >= 0; --i)
if (cur[i].inset().lyxCode() == Inset::TABULAR_CODE) {
+   current_inset = static_cast(&cur[i].inset());
active_cell_ = cur[i].idx();
break;


Glad to here that this fixes the crash. However, the above should be 
const_cast<>. Don't use a sledgehammer when you don't need to.


Angus



Re: [Updated PATCH] Re: crash while dissolving tabular

2007-07-18 Thread Abdelrazak Younes

José Matos wrote:

On Wednesday 18 July 2007 10:13:58 Abdelrazak Younes wrote:

Jürgen Spitzmüller wrote:

Abdelrazak Younes wrote:

I got a much better solution attached.

This seems to work AFAICS.

Jose?


OK.


Done.

Abdel.



Re: [Updated PATCH] Re: crash while dissolving tabular

2007-07-18 Thread José Matos
On Wednesday 18 July 2007 10:13:58 Abdelrazak Younes wrote:
> Jürgen Spitzmüller wrote:
> > Abdelrazak Younes wrote:
> >> I got a much better solution attached.
> >
> > This seems to work AFAICS.
>
> Jose?

OK.

-- 
José Abílio


Re: [Updated PATCH] Re: crash while dissolving tabular

2007-07-18 Thread Abdelrazak Younes

Jürgen Spitzmüller wrote:

Abdelrazak Younes wrote:

I got a much better solution attached.


This seems to work AFAICS.


Jose?



Re: [Updated PATCH] Re: crash while dissolving tabular

2007-07-18 Thread Jürgen Spitzmüller
Abdelrazak Younes wrote:
> I got a much better solution attached.

This seems to work AFAICS.

Thanks.
Jürgen