[LyX/master] Do not compute caret geometry when we are not ready to do so.

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sat Apr 4 15:51:09 UTC 2020


commit 5202d44ef5a9ac491651215405f4cc83a531d865
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Sat Apr 4 18:10:44 2020 +0200

    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 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp
index ab13c68..90b17ba 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;


More information about the lyx-cvs mailing list