Fix some crashes on exit and on windows switch.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20680 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-10-03 07:12:28 +00:00
parent 9b223c494e
commit 1fe543fcd5
3 changed files with 12 additions and 9 deletions

View File

@ -80,8 +80,6 @@ LyXView::LyXView(int id)
LyXView::~LyXView()
{
disconnectBuffer();
disconnectBufferView();
delete dialogs_;
delete autosave_timeout_;
}

View File

@ -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();

View File

@ -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<GuiWorkArea *>(d.tab_widget_->widget(i));
while (d.tab_widget_->count()) {
GuiWorkArea * wa = dynamic_cast<GuiWorkArea *>(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<GuiWorkArea *>(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<QKeyEvent*>(e);
if (d.tab_widget_->count() == 0) {