From 4aeca638875d272169cac207d16ac6624b46d12b Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Fri, 26 Feb 2010 14:07:21 +0000 Subject: [PATCH] Fix bug #6464: Crash when exiting LyX from second window when first window has changed buffer. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33579 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 13056eba5c..e82130e49c 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -1032,16 +1032,16 @@ GuiWorkArea * GuiView::currentWorkArea() GuiWorkArea const * GuiView::currentMainWorkArea() const { - if (d.currentTabWorkArea() == NULL) - return NULL; + if (!d.currentTabWorkArea()) + return 0; return d.currentTabWorkArea()->currentWorkArea(); } GuiWorkArea * GuiView::currentMainWorkArea() { - if (d.currentTabWorkArea() == NULL) - return NULL; + if (!d.currentTabWorkArea()) + return 0; return d.currentTabWorkArea()->currentWorkArea(); } @@ -1049,13 +1049,17 @@ GuiWorkArea * GuiView::currentMainWorkArea() void GuiView::setCurrentWorkArea(GuiWorkArea * wa) { LYXERR(Debug::DEBUG, "Setting current wa: " << wa << endl); - if (wa == NULL) { - d.current_work_area_ = NULL; + if (!wa) { + d.current_work_area_ = 0; d.setBackground(); return; } - GuiWorkArea * old_gwa = theGuiApp()->currentView()->currentWorkArea(); - if (old_gwa == wa) + + // FIXME: I've no clue why this is here and why it accesses + // theGuiApp()->currentView, which might be 0 (bug 6464). + // See also 27525 (vfr). + if (theGuiApp()->currentView() == this + && theGuiApp()->currentView()->currentWorkArea() == wa) return; if (currentBufferView())