Do not compute caret geometry when we are not ready to do so.

This avoid crashes with invalid cache.

Fixes bug #11763.
This commit is contained in:
Jean-Marc Lasgouttes 2020-04-04 18:10:44 +02:00
parent ed137ee435
commit 5202d44ef5

View 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;