From 5202d44ef5a9ac491651215405f4cc83a531d865 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sat, 4 Apr 2020 18:10:44 +0200 Subject: [PATCH] Do not compute caret geometry when we are not ready to do so. This avoid crashes with invalid cache. Fixes bug #11763. --- src/frontends/qt/GuiWorkArea.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp index ab13c687d7..90b17bae6c 100644 --- a/src/frontends/qt/GuiWorkArea.cpp +++ b/src/frontends/qt/GuiWorkArea.cpp @@ -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; -- 2.39.2