From 2f695eb436d3a6e8924665c0d41ccf3fced236bb Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Tue, 24 Feb 2009 08:47:20 +0000 Subject: [PATCH] branch: Fix bug 5797: http://bugzilla.lyx.org/show_bug.cgi?id=5797. 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 --- src/insets/InsetText.cpp | 6 +++++- status.16x | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index a6299a784d..c8af7e53bf 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -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; } } diff --git a/status.16x b/status.16x index 4523dd8167..a8d3c37db1 100644 --- a/status.16x +++ b/status.16x @@ -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