]> git.lyx.org Git - lyx.git/commitdiff
Do not compute caret geometry when we are not ready to do so.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 4 Apr 2020 16:02:04 +0000 (18:02 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 9 Apr 2020 10:51:38 +0000 (12:51 +0200)
This avoid crashes with invalid cache.

Fixes bug #11763.

src/frontends/qt4/GuiWorkArea.cpp
status.23x

index e16ea16e2d413664ee1bf8646b9975cc7905ea73..95cff6d5ec30f8c7d8de4903e3750115022cff16 100644 (file)
@@ -443,12 +443,16 @@ void GuiWorkArea::startBlinkingCaret()
        if (view().busy())
                return;
 
-       Point p;
-       int h = 0;
-       d->buffer_view_->caretPosAndHeight(p, h);
-       // Don't start blinking if the cursor isn't on screen.
-       if (!d->buffer_view_->cursorInView(p, h))
-               return;
+       // we cannot update geometry if not ready and we do not need to if
+       // caret is not in view.
+       if (!d->buffer_view_->buffer().undo().activeUndoGroup()) {
+               Point p;
+               int h = 0;
+               d->buffer_view_->caretPosAndHeight(p, h);
+               // Don't start blinking if the cursor isn't on screen.
+               if (!d->buffer_view_->cursorInView(p, h))
+                       return;
+       }
 
        d->showCaret();
 
@@ -611,6 +615,11 @@ void GuiWorkArea::Private::resizeBufferView()
 
 void GuiWorkArea::Private::updateCaretGeometry()
 {
+       // we cannot update geometry if not ready and we do not need to if
+       // caret is not in view.
+       if (buffer_view_->buffer().undo().activeUndoGroup())
+               return;
+
        Point point;
        int h = 0;
        buffer_view_->caretPosAndHeight(point, h);
index f15bfef153ab377ea6ffa56cda176b6a84542564..70faf48c064e60f2d70ff20edfdd796d6e8d0fa7 100644 (file)
@@ -98,6 +98,8 @@ What's new
 - Preserve paragarph spacing when breaking a paragraph at the start
   (bug 11817).
 
+- Avoid crash in some cases where a dialog is shown during operation
+  (bug 11763).
 
 * INTERNALS