simplify GuiApplication::unregisterView().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24905 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-05-23 10:54:34 +00:00
parent d2a96bcdc3
commit 26e8409172
3 changed files with 5 additions and 15 deletions

View File

@ -982,20 +982,10 @@ void GuiApplication::commitData(QSessionManager & sm)
}
bool GuiApplication::unregisterView(int id)
void GuiApplication::unregisterView(GuiView * gv)
{
LASSERT(d->views_.find(id) != d->views_.end(), /**/);
LASSERT(d->views_[id], /**/);
map<int, GuiView *>::iterator it;
for (it = d->views_.begin(); it != d->views_.end(); ++it) {
if (it->first == id) {
d->views_.erase(id);
break;
}
}
return true;
LASSERT(d->views_[gv->id()] == gv, /**/);
d->views_.erase(gv->id());
}

View File

@ -112,7 +112,7 @@ public:
/// return a suitable monospaced font name.
QString const typewriterFontName();
///
bool unregisterView(int id);
void unregisterView(GuiView * gv);
///
GuiView & view(int id) const;

View File

@ -458,7 +458,7 @@ void GuiView::closeEvent(QCloseEvent * close_event)
it->second->saveSession();
}
guiApp->unregisterView(id_);
guiApp->unregisterView(this);
close_event->accept();
}