Discussion:
[LyX/master] Fix crash when right-clicking into an inset with more paragraphs than the main text.
Georg Baum
2014-05-20 20:03:45 UTC
Permalink
commit c5753af50d8568b7f36797ec8bd67586572fce13
Date: Sun May 18 18:03:06 2014 +0200
Fix crash when right-clicking into an inset with more paragraphs than
the main text.
Fixes: #9123.
diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp
index 8e9fd54..7911c16 100644
--- a/src/frontends/qt4/Menus.cpp
+++ b/src/frontends/qt4/Menus.cpp
@@ -1667,7 +1667,7 @@ void
MenuDefinition::expandEnvironmentSeparators(BufferView const * bv)
return;
pit_type pit = bv->cursor().selBegin().pit();
- Paragraph const & par = bv->buffer().text().getPar(pit);
+ Paragraph const & par = bv->cursor().text()->getPar(pit);
docstring const curlayout = par.layout().name();
docstring outerlayout;
depth_type current_depth = par.params().depth();
This does still crash:
- Create new empty document
- Create empty math formula by C-m
- Click edit menu, the cursor should still be in the math formula => crash,
because par is invalid (there are no paragraphs in mathed).

I propose the attached fix. Of course this will break if we ever have real
text insets for \mbox etc, but I guess there are many more places like that.
OK for master and 2.1?


Georg
Georg Baum
2014-05-20 20:11:04 UTC
Permalink
Post by Georg Baum
I propose the attached fix. Of course this will break if we ever have real
text insets for \mbox etc, but I guess there are many more places like that.
Attached is a better patch which will not break.


Georg
Jürgen Spitzmüller
2014-05-21 06:34:06 UTC
Permalink
Post by Georg Baum
Attached is a better patch which will not break.
Go ahead.

JÃŒrgen
Post by Georg Baum
Georg
Richard Heck
2014-05-21 13:22:41 UTC
Permalink
Post by Georg Baum
Post by Georg Baum
I propose the attached fix. Of course this will break if we ever have real
text insets for \mbox etc, but I guess there are many more places like that.
Attached is a better patch which will not break.
Fine for 2.1.x.

rh

Loading...