From 8bbd8bc44c2f9c290c09cea3f08371d416312dcd Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Fri, 4 Jun 2010 13:24:03 +0000 Subject: [PATCH] Fix bug #6606: Crash when reverting a document with a not available document class. If the document class is not available, we now issue a warning for the user. This triggers a focusInEvent of the WorkArea and the cursor is issued to start blinking. However, when reverting a document the cursor is probably invalid and there has been no chance yet to fix it as we are still reading the file. The solution is to not show the cursor when the view is still busy. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34590 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.cpp | 7 +++++++ src/frontends/qt4/GuiView.h | 5 +++++ src/frontends/qt4/GuiWorkArea.cpp | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 5c89e8dbed..c6139666e2 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -1011,8 +1011,15 @@ bool GuiView::focusNextPrevChild(bool /*next*/) } +bool GuiView::busy() +{ + return busy_; +} + + void GuiView::setBusy(bool busy) { + busy_ = busy; if (d.current_work_area_) { d.current_work_area_->setUpdatesEnabled(!busy); if (busy) diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index b540094f0b..33f9fb3108 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -73,7 +73,10 @@ public: int id() const { return id_; } + /// void setBusy(bool); + /// are we busy ? + bool busy(); /// \name Generic accessor functions //@{ @@ -402,6 +405,8 @@ private: /// flag to avoid two concurrent close events. bool closing_; + /// if the view is busy the cursor shouldn't blink for instance. + bool busy_; }; } // namespace frontend diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 9d9d82abf8..368fa774b1 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -391,6 +391,10 @@ void GuiWorkArea::stopBlinkingCursor() void GuiWorkArea::startBlinkingCursor() { + // do not show the cursor if the view is busy + if (view().busy()) + return; + Point p; int h = 0; buffer_view_->cursorPosAndHeight(p, h); -- 2.39.2