Abdelrazak Younes wrote:
Jean-Marc Lasgouttes wrote:
[This is with or without my previous menu patch]

- run LyX
- Help>Introduction
- Help>Tutorial
- View>Intro.lyx
- exit

===> crash!

This patch fixes this crash and a few others. Will commit soon unless someone has an objection.


Hum, updated patch without the GuiWorkArea change.

Abdel.

Index: BufferView_pimpl.C
===================================================================
--- BufferView_pimpl.C  (revision 14813)
+++ BufferView_pimpl.C  (working copy)
@@ -260,6 +260,12 @@
                        boost::tie(cursor_.pit(), cursor_.pos()) );
        }
 
+       // If we're quitting lyx, don't bother updating stuff
+       if (quitting) {
+               buffer_ = 0;
+               return;
+       }
+
        // If we are closing current buffer, switch to the first in
        // buffer list.
        if (!b) {
@@ -277,10 +283,6 @@
        anchor_ref_ = 0;
        offset_ref_ = 0;
 
-       // If we're quitting lyx, don't bother updating stuff
-       if (quitting)
-               return;
-
        if (buffer_) {
                lyxerr[Debug::INFO] << BOOST_CURRENT_FUNCTION
                                    << "Buffer addr: " << buffer_ << endl;
Index: frontends/LyXView.C
===================================================================
--- frontends/LyXView.C (revision 14813)
+++ frontends/LyXView.C (working copy)
@@ -139,22 +139,19 @@
 
        work_area_->bufferView().setBuffer(b);
 
-       if (work_area_->bufferView().buffer())
-       {
+       if (work_area_->bufferView().buffer()) {
                // Buffer-dependent dialogs should be updated or
                // hidden. This should go here because some dialogs (eg ToC)
                // require bv_->text.
                getDialogs().updateBufferDependent(true);
+               connectBuffer(*work_area_->bufferView().buffer());
+               setLayout(work_area_->bufferView().firstLayout());
        }
 
        updateMenubar();
        updateToolbars();
        updateLayoutChoice();
        updateWindowTitle();
-       if (b) {
-               connectBuffer(*b);
-               setLayout(work_area_->bufferView().firstLayout());
-       }
        redrawWorkArea();
 }
 
Index: frontends/WorkArea.C
===================================================================
--- frontends/WorkArea.C        (revision 14813)
+++ frontends/WorkArea.C        (working copy)
@@ -192,6 +192,7 @@
 
        if (!buffer_view_->buffer()) {
                greyOut();
+               updateScrollbar();
                return;
        }
 
Index: lyxfunc.C
===================================================================
--- lyxfunc.C   (revision 14813)
+++ lyxfunc.C   (working copy)
@@ -1611,13 +1611,14 @@
                            && !lyxaction.funcHasFlag(cmd.action, 
LyXAction::NoBuffer)
                            && !lyxaction.funcHasFlag(cmd.action, 
LyXAction::ReadOnly))
                                view()->buffer()->markDirty();
-               }
 
-               if (view()->cursor().inTexted()) {
-                       view()->owner()->updateLayoutChoice();
+                       if (view()->cursor().inTexted()) {
+                               view()->owner()->updateLayoutChoice();
+                       }
                }
        }
-       sendDispatchMessage(_(getMessage()), cmd);
+       if (!quitting)
+               sendDispatchMessage(_(getMessage()), cmd);
 }
 
 

Reply via email to