The attached patch fixes a thinko of mine which results in a crash when
left-clicking in an inset when it has more paragraphs than the main text.
The problem is that we were getting the paragraph from the main buffer
instead of the place where the cursor really is. Thus the files crash
because the passed pit is greater than the lastpit of the main buffer.
OK for master and branch?
Jürgen
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();
@@ -1677,7 +1677,7 @@ void
MenuDefinition::expandEnvironmentSeparators(BufferView const * bv)
if (pit == 0 || cpar.params().depth() == 0)
break;
--pit;
- cpar = bv->buffer().text().getPar(pit);
+ cpar = bv->cursor().text()->getPar(pit);
if (cpar.params().depth() < current_depth
&& cpar.layout().isEnvironment()) {
outerlayout = cpar.layout().name();