GetStatus of an InsetCollapsable asserts for unhandled commands.

When you add a command to the context menu of an InsetCollapsable of which the getStatus method does not handle this command, an assertion will be raised. This happens when getStatus doesn't handle a command it is forwarded to text::getStatus which asserts because cur.text() is the text the inset is in, while this is the text of the inset. So, we only dispatch to text_ if the cursor is inside the text_. This is not the case for e.g. context menus.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@28591 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-02-24 08:47:20 +00:00
parent 7399607f0e
commit 2f695eb436
2 changed files with 11 additions and 2 deletions

View File

@ -271,7 +271,11 @@ bool InsetText::getStatus(Cursor & cur, FuncRequest const & cmd,
status.setEnabled(allowParagraphCustomization());
return true;
default:
return text_.getStatus(cur, cmd, status);
// Dispatch only to text_ if the cursor is inside
// the text_. It is not for context menus (bug 5797).
if (cur.text() == &text_)
return text_.getStatus(cur, cmd, status);
return false;
}
}

View File

@ -191,7 +191,12 @@ What's new
This fixes a crash when attempting to insert plain text (bug 5671).
- Fix the synchronisation of insets when they are shown in two different
views. This could also have lead to an assertion (bug 4346).
views. This could also have lead to an assertion (bug 4346).
- Fix an assertion when the status of a command in the context menu of
an InsetCollapsable is requested which is not handled by the inset.
This might happen when the user modifies the ui or when the right
mouse button is dragged (bug 5797).
- Speed up editing with Outliner open with Qt >= 4.3. This should
especially pay off on the Mac, if the Outliner shows as a drawer