From 8be314e1d95c59b4b0f3725b05d5267d413f62cd Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 29 Apr 2011 09:50:04 +0200 Subject: [PATCH] Add debug to bat label seg fault bug --- bacula/src/qt-console/label/label.cpp | 20 ++++++++++++++------ bacula/src/qt-console/pages.cpp | 6 +++--- bacula/src/qt-console/pages.h | 15 ++++++++++----- bacula/src/qt-console/util/fmtwidgetitem.cpp | 2 ++ 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/bacula/src/qt-console/label/label.cpp b/bacula/src/qt-console/label/label.cpp index e70aa94faa..6b43496aca 100644 --- a/bacula/src/qt-console/label/label.cpp +++ b/bacula/src/qt-console/label/label.cpp @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2007 Free Software Foundation Europe e.V. + Copyright (C) 2007-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -96,11 +96,15 @@ void labelPage::okButtonPushed() .arg(storageCombo->currentText()) .arg(slotSpin->value()); if (mainWin->m_commandDebug) { - Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data()); + Pmsg1(000, "sending command : %s\n", scmd.toUtf8().data()); + } + if (m_console) { + m_console->write_dir(scmd.toUtf8().data()); + m_console->displayToPrompt(m_conn); + m_console->notify(m_conn, true); + } else { + Pmsg0(000, "m_console==NULL !!!!!!\n"); } - m_console->write_dir(scmd.toUtf8().data()); - m_console->displayToPrompt(m_conn); - m_console->notify(m_conn, true); closeStackPage(); mainWin->resetFocus(); } @@ -108,7 +112,11 @@ void labelPage::okButtonPushed() void labelPage::cancelButtonPushed() { this->hide(); - m_console->notify(m_conn, true); + if (m_console) { + m_console->notify(m_conn, true); + } else { + Pmsg0(000, "m_console==NULL !!!!!!\n"); + } closeStackPage(); mainWin->resetFocus(); } diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index 096932e2cc..c98e43eb8d 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2010 Free Software Foundation Europe e.V. + Copyright (C) 2007-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -26,8 +26,6 @@ Switzerland, email:ftf@fsfeurope.org. */ /* - * Version $Id$ - * * Dirk Bartley, March 2007 */ @@ -58,6 +56,8 @@ Pages::Pages() m_onceDocked = false; m_closeable = true; m_dockOnFirstUse = true; + m_console = NULL; + m_parent = NULL; } /* first Use Dock */ diff --git a/bacula/src/qt-console/pages.h b/bacula/src/qt-console/pages.h index ea098546b1..6dc2d478f6 100644 --- a/bacula/src/qt-console/pages.h +++ b/bacula/src/qt-console/pages.h @@ -3,7 +3,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2007 Free Software Foundation Europe e.V. + Copyright (C) 2007-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -28,8 +28,6 @@ Switzerland, email:ftf@fsfeurope.org. */ /* - * Version $Id$ - * * Dirk Bartley, March 2007 */ @@ -55,6 +53,7 @@ class Console; class Pages : public QWidget { public: + /* methods */ Pages(); void dockPage(); void undockPage(); @@ -63,8 +62,6 @@ public: bool isDocked(); bool isOnceDocked(); bool isCloseable(); - QTabWidget *m_parent; - QList m_contextActions; virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); void closeStackPage(); @@ -81,11 +78,17 @@ public: void getStatusList(QStringList &); void firstUseDock(); + /* members */ + QTabWidget *m_parent; + QList m_contextActions; + + public slots: /* closeEvent is a virtual function inherited from QWidget */ virtual void closeEvent(QCloseEvent* event); protected: + /* methods */ void pgInitialize(); void pgInitialize(const QString &); void pgInitialize(const QString &, QTreeWidgetItem *); @@ -93,6 +96,8 @@ protected: virtual void changeEvent(QEvent *event); void setConsoleCurrent(); void setTitle(); + + /* members */ bool m_closeable; bool m_docked; bool m_onceDocked; diff --git a/bacula/src/qt-console/util/fmtwidgetitem.cpp b/bacula/src/qt-console/util/fmtwidgetitem.cpp index 3971fc5eb7..3d51d277d6 100644 --- a/bacula/src/qt-console/util/fmtwidgetitem.cpp +++ b/bacula/src/qt-console/util/fmtwidgetitem.cpp @@ -87,6 +87,7 @@ Freeze::~Freeze() ItemFormatterBase::BYTES_CONVERSION ItemFormatterBase::cnvFlag(BYTES_CONVERSION_IEC); +/* String to Electronic value based on K=1024 */ QString convertBytesIEC(qint64 qfld) { static const qint64 KB = Q_INT64_C(1024); @@ -132,6 +133,7 @@ QString convertBytesIEC(qint64 qfld) return QString("%1 %2iB").arg(qfld / 1000.0, 0, 'f', 2).arg(suffix); } +/* String to human value based on k=1000 */ QString convertBytesSI(qint64 qfld) { static const qint64 KB = Q_INT64_C(1000); -- 2.39.5