On Mon, Mar 24, 2008 at 09:18:43AM -0500, Bo Peng wrote:
> On Mon, Mar 24, 2008 at 9:13 AM, Jürgen Spitzmüller
> <[EMAIL PROTECTED]> wrote:
> > rgheck wrote:
> >  > > Open a document with a listings inset, right click, settings. Most of
> >  > > the time, lyx will crash here (Linux, RHEL4, gcc 4.1, qt 4.22)
> >
> >  FWIW, I see this too:
> >  http://bugzilla.lyx.org/show_bug.cgi?id=4607

And this is related to change 21734:

frontends/qt4/GuiView.cpp:

 21734        case LFUN_INSET_APPLY: {
 21734                if (!buf) {
 21734                        enable = false;
 21734                        break;
 21734                }
 21734                string const name = cmd.getArg(0);
 21734                Inset * inset = getOpenInset(name);
 21734                if (inset) {
 21734                        FuncRequest fr(LFUN_INSET_MODIFY, cmd.argument());
 21734                        FuncStatus fs;
 21734                        if (!inset->getStatus(view()->cursor(), fr, fs)) {
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 21734                                // Every inset is supposed to handle this
 21734                                BOOST_ASSERT(false);
 21734                        }
 21734                        flag |= fs;
 21734                } else {
 21734                        FuncRequest fr(LFUN_INSET_INSERT, cmd.argument());
 21734                        flag |= getStatus(fr);
 21734                }
 21734                enable = flag.enabled();
 21734                break;
 21734        }

and

 21681     younes       case LFUN_DIALOG_TOGGLE:
 21681     younes       case LFUN_DIALOG_SHOW:
 23793      sanda       case LFUN_UI_TOGGLE:
 21681     younes       case LFUN_DIALOG_UPDATE:
 23735        sts               // FIXME: add special handling for about
and prefs dialogs here
 23735        sts               // which do not depend on GuiView.
 23735        sts               if (lyx_view_)
 22286        sts                       return
lyx_view_->getStatus(cmd);
 22286        sts               else
 22286        sts                       enable = false;
 22286        sts               break;


The marked line calls getStatus with a cursor that's possibly unrelated
to the inset (in out case outside). On the other hand,
Text::getStatus() called by Inset{Text,Collapsable,Listings}::getStatus()
assumes that the passed cursor is one "pointing to the Text".

This invariant is violated here, hence the assert/crash.

Abdel, Stefan, could you have a look?

Andre'

Reply via email to