From: Kern Sibbald Date: Sun, 12 Sep 2010 12:59:55 +0000 (+0200) Subject: Fix another bat seg fault X-Git-Tag: Release-5.2.1~1118 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2934d75db82f421a73a808dcf1cd3ff5bac2e2de;p=bacula%2Fbacula Fix another bat seg fault --- diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 7a6790e00d..b421fc0029 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -292,10 +292,10 @@ bool Console::sql_cmd(int &conn, const char *query, QStringList &results, bool d return false; } - if (mainWin->m_connDebug) - Pmsg2(000, "sql_cmd conn %i %s\n", conn, query); - if (donotify) + if (mainWin->m_connDebug) Pmsg2(000, "sql_cmd conn %i %s\n", conn, query); + if (donotify) { dircomm->notify(false); + } mainWin->waitEnter(); pm_strcpy(cmd, ".sql query=\""); @@ -314,15 +314,17 @@ bool Console::sql_cmd(int &conn, const char *query, QStringList &results, bool d QString dum = dircomm->msg(); if ((dum.left(6) == "*None*")) doappend = false; } - if (doappend) + if (doappend) { results << dircomm->msg(); + } first = false; } - if (donotify) + if (donotify) { dircomm->notify(true); + } discardToPrompt(conn); mainWin->waitExit(); - return true; /* ***FIXME*** return any command error */ + return !mainWin->isClosing(); /* return false if closing */ } /* diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index eca18bd28d..15d7565825 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -177,11 +177,12 @@ void MainWin::createPages() new MediaList(); new MediaView(); new Storage(); - if (m_openBrowser) + if (m_openBrowser) { new restoreTree(); - if (m_openDirStat) + } + if (m_openDirStat) { new DirStat(); - + } treeWidget->expandItem(topItem); tabWidget->setCurrentWidget(m_currentConsole); } @@ -323,10 +324,14 @@ void MainWin::waitEnter() */ void MainWin::waitExit() { + if (!m_waitState || m_isClosing) { + return; + } m_waitState = false; if (mainWin->m_connDebug) Pmsg0(000, "Exiting Wait State\n"); - if (m_waitTreeItem != treeWidget->currentItem()) + if (m_waitTreeItem && (m_waitTreeItem != treeWidget->currentItem())) { treeWidget->setCurrentItem(m_waitTreeItem); + } if (m_doConnect) { connectSignals(); connectConsoleSignals(); diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 4a25d7e5ae..6203f03b11 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -61,6 +61,7 @@ public: void hashRemove(QTreeWidgetItem *, Pages *); void setMessageIcon(); bool getWaitState() {return m_waitState; }; + bool isClosing() {return m_isClosing; }; Console *currentConsole(); QTreeWidgetItem *currentTopItem(); Pages* getFromHash(QTreeWidgetItem *); diff --git a/bacula/src/qt-console/restore/restoretree.cpp b/bacula/src/qt-console/restore/restoretree.cpp index f6b79f0b28..82fd10ad80 100644 --- a/bacula/src/qt-console/restore/restoretree.cpp +++ b/bacula/src/qt-console/restore/restoretree.cpp @@ -275,6 +275,8 @@ void restoreTree::populateDirectoryTree() fieldcnt += 1; } } + } else { + return; } } else { QMessageBox::warning(this, "Bat",