Vincent van Ravesteijn - TNW wrote:
   if (cur.nextInset()) {
       cur.nextInset()->edit(cur, true);
       cur.niceInsert(sel);
   }

prevents the crash, but the regexp inset seems to not have been
inserted
at all (or, if it is, then it is not shown and the cursor cannot
navigate on it).

Yes, of course. The code is now never executed because cur.nextInset()
is false. And it returns false because the inset has not been inserted.
hmmm, looking at the preceding line:

       cur.insert(new InsetMathHull(cur.buffer(), hullRegexp));
       if (cur.nextInset()) {
               cur.nextInset()->edit(cur, true);
               cur.niceInsert(sel);
       }

What happens now is that the cur.insert() call is made anyway, but, if there was a selection when pressing C-S-r, then it is not reinserted in the regexp inset anymore (this is the crashing code that has been excluded).

However, unless the cur.insert() method stops at some point due to the unallowed nesting of inset, I would assume it has been inserted, am I wrong ?

Perhaps, I should tweak the InsetERT::plaintext() method to search also for possibly nested insets. Or, if I stop there with gdb, what variables can I check to verify whether there is a nested inset somewhere or not ?

Thanks,

   T.

Reply via email to