]> git.sur5r.net Git - bacula/bacula/commitdiff
prevent a segfault when closing and there are child objects in the page selector.
authorDirk H Bartley <dbartley@schupan.com>
Fri, 27 Jul 2007 02:35:39 +0000 (02:35 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Fri, 27 Jul 2007 02:35:39 +0000 (02:35 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5248 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/mainwin.cpp

index 566c702653c198767e5d24f442632ae8daf20ae6..4f073cf1a539ca231c5d04971719fd88ef88c2f3 100644 (file)
@@ -248,10 +248,15 @@ void MainWin::closeEvent(QCloseEvent *event)
    m_isClosing = true;
    writeSettings();
    /* close all non console pages, this will call settings in destructors */
-   foreach(Pages *page, m_pagehash) {
-      if (page !=  page->console()) {
-         page->console()->setCurrent();
-         page->closeStackPage();
+   while (m_consoleHash.count() < m_pagehash.count()) {
+      foreach(Pages *page, m_pagehash) {
+         if (page !=  page->console()) {
+            QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(page);
+            if (pageSelectorTreeWidgetItem->childCount() == 0) {
+               page->console()->setCurrent();
+               page->closeStackPage();
+            }
+         }
       }
    }
    /* close the console pages and terminate connection */