From: Dirk H Bartley Date: Fri, 27 Jul 2007 02:35:39 +0000 (+0000) Subject: prevent a segfault when closing and there are child objects in the page selector. X-Git-Tag: Release-7.0.0~5938 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c1f872b73f0e203e18af2fc6ab0bef70564ef8c5;p=bacula%2Fbacula prevent a segfault when closing and there are child objects in the page selector. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5248 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 566c702653..4f073cf1a5 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -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 */