From b1910bbcf417be3cbebf50e7a1c3666d8ca46a37 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Mon, 21 Sep 2009 16:52:04 +0000 Subject: [PATCH] Pointer cleanup as suggested by Enrico who noticed a crash when closing a buffer on Cgwin. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31436 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyXFunc.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 64f60042dc..281dc7940b 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -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. -- 2.39.2