diff --git a/src/frontends/LyXView.cpp b/src/frontends/LyXView.cpp index 4b1f34d1f8..72f625de43 100644 --- a/src/frontends/LyXView.cpp +++ b/src/frontends/LyXView.cpp @@ -80,8 +80,6 @@ LyXView::LyXView(int id) LyXView::~LyXView() { - disconnectBuffer(); - disconnectBufferView(); delete dialogs_; delete autosave_timeout_; } diff --git a/src/frontends/WorkAreaManager.cpp b/src/frontends/WorkAreaManager.cpp index 7970bfaf26..4957f7bc3b 100644 --- a/src/frontends/WorkAreaManager.cpp +++ b/src/frontends/WorkAreaManager.cpp @@ -47,9 +47,6 @@ void WorkAreaManager::redrawAll() void WorkAreaManager::closeAll() { - if (quitting) - return; - while (!work_areas_.empty()) // WorkArea is de-registering itself. (*work_areas_.begin())->close(); diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 372cad79b4..2ce2de6998 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -294,10 +294,10 @@ GuiViewBase::~GuiViewBase() void GuiViewBase::close() { quitting_by_menu_ = true; - for (int i = 0; i != d.tab_widget_->count(); ++i) { - GuiWorkArea * wa = dynamic_cast(d.tab_widget_->widget(i)); + while (d.tab_widget_->count()) { + GuiWorkArea * wa = dynamic_cast(d.tab_widget_->widget(0)); BOOST_ASSERT(wa); - d.tab_widget_->removeTab(i); + d.tab_widget_->removeTab(0); delete wa; } QMainWindow::close(); @@ -722,7 +722,6 @@ bool GuiViewBase::event(QEvent * e) switch (e->type()) { // Useful debug code: - //case QEvent::WindowActivate: //case QEvent::ActivationChange: //case QEvent::WindowDeactivate: //case QEvent::Paint: @@ -737,6 +736,15 @@ bool GuiViewBase::event(QEvent * e) //case QEvent::Drop: // break; + case QEvent::WindowActivate: { + GuiWorkArea * wa = dynamic_cast(d.tab_widget_->currentWidget()); + BOOST_ASSERT(wa); + BufferView & bv = wa->bufferView(); + connectBufferView(bv); + connectBuffer(bv.buffer()); + return QMainWindow::event(e); + } + case QEvent::ShortcutOverride: { QKeyEvent * ke = static_cast(e); if (d.tab_widget_->count() == 0) {