Peter Kümmel wrote:
Abdelrazak Younes wrote:
What about this patch?
Much better than what we have now!

Shove it in...

Done.

Was this the bug Asger talked about ('Fix cursor trouble')?

I don't think so. I guess he was talking about the big black square that served as cursor. I fixed that earlier this week.

But there are other problems with the new GuiWorkArea/QLPainter/Cursor interaction. Recipe for crash:

1) open Help->Introduction
2) open again Help->Introduction
3) choose "Revert to Document"

BOOM

This is very tricky and it was very hard to find. The problem is that GuiWorkArea::paintEvent() uses the Buffer before it is completely constructed. Buffer::pimpl is still equal to 0, hence the crash in the Painter.

The attached patch partly solves the problem but there is more to it. It fixes the painter crash but there are some other crashes behind :-(

Abdel.
Index: frontends/LyXView.C
===================================================================
--- frontends/LyXView.C (revision 15553)
+++ frontends/LyXView.C (working copy)
@@ -105,6 +105,8 @@
 
 void LyXView::setBuffer(Buffer * b)
 {
+       busy(true);
+
        if (work_area_->bufferView().buffer())
                disconnectBuffer();
 
@@ -129,12 +131,15 @@
        updateLayoutChoice();
        updateWindowTitle();
        updateStatusBar();
+       busy(false);
        work_area_->redraw();
 }
 
 
 bool LyXView::loadLyXFile(string const & filename, bool tolastfiles)
 {
+       busy(true);
+
        if (work_area_->bufferView().buffer())
                disconnectBuffer();
 
@@ -149,6 +154,7 @@
                showErrorList("Parse");
        }
        updateStatusBar();
+       busy(false);
        work_area_->redraw();
        return loaded;
 }
Index: frontends/LyXView.h
===================================================================
--- frontends/LyXView.h (revision 15548)
+++ frontends/LyXView.h (working copy)
@@ -93,7 +93,7 @@
        virtual void saveGeometry() = 0;
 
        /// show busy cursor
-       virtual void busy(bool) const = 0;
+       virtual void busy(bool) = 0;
 
        virtual Toolbars::ToolbarPtr makeToolbar(ToolbarBackend::Toolbar const 
& tbb) = 0;
 
Index: frontends/qt4/GuiView.C
===================================================================
--- frontends/qt4/GuiView.C     (revision 15548)
+++ frontends/qt4/GuiView.C     (working copy)
@@ -12,9 +12,10 @@
 
 #include <config.h>
 
+#include "GuiView.h"
+
 #include "GuiImplementation.h"
-
-#include "GuiView.h"
+#include "GuiWorkArea.h"
 #include "QLMenubar.h"
 #include "QLToolbar.h"
 #include "QCommandBuffer.h"
@@ -288,8 +289,10 @@
 }
 
 
-void GuiView::busy(bool yes) const
+void GuiView::busy(bool yes)
 {
+       static_cast<GuiWorkArea *>(work_area_)->setUpdatesEnabled(!yes);
+
        if (yes)
                QApplication::setOverrideCursor(Qt::WaitCursor);
        else
Index: frontends/qt4/GuiView.h
===================================================================
--- frontends/qt4/GuiView.h     (revision 15548)
+++ frontends/qt4/GuiView.h     (working copy)
@@ -63,7 +63,7 @@
                int posx, int posy,
                bool maximize);
        virtual void saveGeometry();
-       virtual void busy(bool) const;
+       virtual void busy(bool);
        Toolbars::ToolbarPtr makeToolbar(ToolbarBackend::Toolbar const & tbb);
        virtual void updateStatusBar();
        virtual void message(lyx::docstring const & str);

Reply via email to