From c1f872b73f0e203e18af2fc6ab0bef70564ef8c5 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Fri, 27 Jul 2007 02:35:39 +0000 Subject: [PATCH] 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 --- bacula/src/qt-console/mainwin.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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 */ -- 2.39.5