]> git.lyx.org Git - features.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:10:44 +0000 (18:10 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 4 Apr 2020 16:11:07 +0000 (18:11 +0200)
This avoid crashes with invalid cache.

Fixes bug #11763.

src/frontends/qt/GuiWorkArea.cpp

index ab13c687d7c9d549299508303bea29a33371f30f..90b17bae6ca93bedce26a82c0e5f739e18f4e2ec 100644 (file)
@@ -443,8 +443,10 @@ void GuiWorkArea::startBlinkingCaret()
        if (view().busy())
                return;
 
-       // Don't start blinking if the cursor isn't on screen.
-       if (!d->buffer_view_->caretInView())
+       // Don't start blinking if the cursor isn't on screen, unless we
+       // are not ready to know whether the cursor is on screen.
+       if (!d->buffer_view_->buffer().undo().activeUndoGroup()
+           && !d->buffer_view_->caretInView())
                return;
 
        d->showCaret();
@@ -608,7 +610,10 @@ void GuiWorkArea::Private::resizeBufferView()
 
 void GuiWorkArea::Private::updateCaretGeometry()
 {
-       if (!buffer_view_->caretInView())
+       // 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()
+           || !buffer_view_->caretInView())
                return;
 
        Point point;