From: Jean-Marc Lasgouttes Date: Sat, 4 Apr 2020 16:10:44 +0000 (+0200) Subject: Do not compute caret geometry when we are not ready to do so. X-Git-Tag: lyx-2.4.0dev-acb2ca7b~1049 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=5202d44ef5a9ac491651215405f4cc83a531d865;p=features.git Do not compute caret geometry when we are not ready to do so. This avoid crashes with invalid cache. Fixes bug #11763. --- 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;