]> git.lyx.org Git - lyx.git/commitdiff
simplify GuiApplication::unregisterView().
authorAbdelrazak Younes <younes@lyx.org>
Fri, 23 May 2008 10:54:34 +0000 (10:54 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 23 May 2008 10:54:34 +0000 (10:54 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24905 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiApplication.h
src/frontends/qt4/GuiView.cpp

index 874ee04e0288f7e37304075aff4a4d5fcf24b3db..44896ed08c732cc32364f961c2a79356ff26000f 100644 (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());
 }
 
 
index 97b6c4622a4a865839d81f819b7d83c1c74823cf..7249631d27e77d82eb7d0850ebb70a0aeeaaa6ed 100644 (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;
 
index 63bd54ec63c476087b971512b96e55f65fe1eb06..3856e762803b68a13b5a92286e4d091d7f081dfc 100644 (file)
@@ -458,7 +458,7 @@ void GuiView::closeEvent(QCloseEvent * close_event)
                        it->second->saveSession();
        }
 
-       guiApp->unregisterView(id_);
+       guiApp->unregisterView(this);
        close_event->accept();
 }