]> git.lyx.org Git - features.git/commitdiff
Pointer cleanup as suggested by Enrico who noticed a crash when closing a buffer...
authorAbdelrazak Younes <younes@lyx.org>
Mon, 21 Sep 2009 16:52:04 +0000 (16:52 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 21 Sep 2009 16:52:04 +0000 (16:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31436 a592a061-630c-0410-9148-cb99ea01b6c8

src/LyXFunc.cpp

index 64f60042dcda2b7f26743f5231da90a8c1d54b73..281dc7940b54b101dbffa98073b13c1779fa93d4 100644 (file)
@@ -1091,9 +1091,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        if (lyx_view_ == 0)
                                break;
 
-                       BufferView * bv = lyx_view_->currentBufferView();
-                       BufferView * doc_bv = lyx_view_->documentBufferView();
-
                        // Start an undo group. This may be needed for
                        // some stuff like inset-apply on labels.
                        if (theBufferList().isLoaded(buffer))
@@ -1101,7 +1098,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                
                        // Let the current LyXView dispatch its own actions.
                        if (lyx_view_->dispatch(cmd)) {
+                               BufferView * bv = lyx_view_->currentBufferView();
                                if (bv) {
+                                       buffer = &(bv->buffer());
                                        updateFlags = bv->cursor().result().update();
                                        if (theBufferList().isLoaded(buffer))
                                                buffer->undo().endUndoGroup();
@@ -1109,16 +1108,20 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                break;
                        }
 
+                       BufferView * bv = lyx_view_->currentBufferView();
                        LASSERT(bv, /**/);
 
                        // Let the current BufferView dispatch its own actions.
                        if (bv->dispatch(cmd)) {
                                // The BufferView took care of its own updates if needed.
+                               buffer = &(bv->buffer());
                                updateFlags = Update::None;
                                if (theBufferList().isLoaded(buffer))
                                        buffer->undo().endUndoGroup();
                                break;
                        }
+
+                       BufferView * doc_bv = lyx_view_->documentBufferView();
                        // Try with the document BufferView dispatch if any.
                        if (doc_bv && doc_bv->dispatch(cmd)) {
                                // The BufferView took care of its own updates if needed.