]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiView.cpp
Fix the following sort of crash, reported on the list. This is also
[lyx.git] / src / frontends / qt4 / GuiView.cpp
index eb689ce56b5d5291f78e22bd3d218c2766f397e9..65a1d3a6f65173bd2c84177a260488fb16682034 100644 (file)
@@ -1216,17 +1216,23 @@ void GuiView::setCurrentWorkArea(GuiWorkArea * wa)
 
        theGuiApp()->setCurrentView(this);
        d.current_work_area_ = wa;
+       
+       // We need to reset this now, because it will need to be
+       // right if the tabWorkArea gets reset in the for loop. We
+       // will change it back if we aren't in that case.
+       GuiWorkArea * const old_cmwa = d.current_main_work_area_;
+       d.current_main_work_area_ = wa;
+
        for (int i = 0; i != d.splitter_->count(); ++i) {
                if (d.tabWorkArea(i)->setCurrentWorkArea(wa)) {
-                       //if (d.current_main_work_area_)
-                       //      d.current_main_work_area_->setFrameStyle(QFrame::NoFrame);
-                       d.current_main_work_area_ = wa;
-                       //d.current_main_work_area_->setFrameStyle(QFrame::Box | QFrame::Plain);
-                       //d.current_main_work_area_->setLineWidth(2);
-                       LYXERR(Debug::DEBUG, "Current wa: " << currentWorkArea() << ", Current main wa: " << currentMainWorkArea());
+                       LYXERR(Debug::DEBUG, "Current wa: " << currentWorkArea() 
+                               << ", Current main wa: " << currentMainWorkArea());
                        return;
                }
        }
+       
+       d.current_main_work_area_ = old_cmwa;
+       
        LYXERR(Debug::DEBUG, "This is not a tabbed wa");
        on_currentWorkAreaChanged(wa);
        BufferView & bv = wa->bufferView();