From: Kern Sibbald Date: Fri, 12 Nov 2010 08:02:06 +0000 (+0100) Subject: Prevent timer recursion in bat X-Git-Tag: Release-7.0.0~1434 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c6da23ae4f57650827c08895b7e9428bb24336eb;p=bacula%2Fbacula Prevent timer recursion in bat --- diff --git a/bacula/src/qt-console/status/clientstat.cpp b/bacula/src/qt-console/status/clientstat.cpp index 37b98315fd..b36b22bf58 100644 --- a/bacula/src/qt-console/status/clientstat.cpp +++ b/bacula/src/qt-console/status/clientstat.cpp @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2009 Free Software Foundation Europe e.V. + Copyright (C) 2007-2010 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,7 +26,6 @@ Switzerland, email:ftf@fsfeurope.org. */ /* - * Version $Id: clientstat.cpp 5880 2007-11-09 01:20:40Z bartleyd2 $ * * Dirk Bartley, March 2007 */ @@ -36,6 +35,9 @@ #include #include "clientstat.h" +/* This probably should be on a mutex */ +static bool working = false; /* prevent timer recursion */ + /* * Constructor for the class */ @@ -96,12 +98,14 @@ void ClientStat::timerTriggered() { double value = timerDisplay->value(); value -= 1; - if (value == 0) { + if (value <= 0 && !working) { + working = true; value = spinBox->value(); bool iscurrent = mainWin->tabWidget->currentIndex() == mainWin->tabWidget->indexOf(this); if (((isDocked() && iscurrent) || (!isDocked())) && (checkBox->checkState() == Qt::Checked)) { populateAll(); } + working = false; } timerDisplay->display(value); } @@ -211,7 +215,7 @@ void ClientStat::populateRunning() } /* - * When the treeWidgetItem in the page selector tree is singleclicked, Make sure + * When the treeWidgetItem in the page selector tree is single clicked, Make sure * The tree has been populated. */ void ClientStat::PgSeltreeWidgetClicked() diff --git a/bacula/src/qt-console/status/dirstat.cpp b/bacula/src/qt-console/status/dirstat.cpp index 8a9bd6049f..47c77fc886 100644 --- a/bacula/src/qt-console/status/dirstat.cpp +++ b/bacula/src/qt-console/status/dirstat.cpp @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2009 Free Software Foundation Europe e.V. + Copyright (C) 2007-2010 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,7 +26,6 @@ Switzerland, email:ftf@fsfeurope.org. */ /* - * Version $Id: dirstat.cpp 5880 2007-11-09 01:20:40Z bartleyd2 $ * * Dirk Bartley, March 2007 */ @@ -36,6 +35,8 @@ #include #include "dirstat.h" +static bool working = false; /* prevent timer recursion */ + /* * Constructor for the class */ @@ -97,12 +98,14 @@ void DirStat::timerTriggered() { double value = timerDisplay->value(); value -= 1; - if (value == 0) { + if (value <= 0 && !working) { + working = true; value = spinBox->value(); bool iscurrent = mainWin->tabWidget->currentIndex() == mainWin->tabWidget->indexOf(this); if (((isDocked() && iscurrent) || ((!isDocked()) && isOnceDocked())) && (checkBox->checkState() == Qt::Checked)) { populateAll(); } + working = false; } timerDisplay->display(value); } @@ -171,7 +174,7 @@ void DirStat::populateTerminated() p_tableitem->setBackground(Qt::green); else p_tableitem->setBackground(Qt::red); - } + } terminatedTable->setItem(results.size() - row - 1, column, p_tableitem); column += 1; } diff --git a/bacula/src/qt-console/status/storstat.cpp b/bacula/src/qt-console/status/storstat.cpp index b1673ad833..f5235b38cf 100644 --- a/bacula/src/qt-console/status/storstat.cpp +++ b/bacula/src/qt-console/status/storstat.cpp @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2009 Free Software Foundation Europe e.V. + Copyright (C) 2007-2010 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,7 +26,6 @@ Switzerland, email:ftf@fsfeurope.org. */ /* - * Version $Id: storstat.cpp 5880 2007-11-09 01:20:40Z bartleyd2 $ * * Dirk Bartley, March 2007 */ @@ -38,6 +37,8 @@ #include "mount/mount.h" #include "label/label.h" +static bool working = false; /* prevent timer recursion */ + /* .status storage= where is the storage name in the Director, and @@ -113,12 +114,14 @@ void StorStat::timerTriggered() { double value = timerDisplay->value(); value -= 1; - if (value == 0) { + if (value <= 0 && !working) { + working = true; value = spinBox->value(); bool iscurrent = mainWin->tabWidget->currentIndex() == mainWin->tabWidget->indexOf(this); if (((isDocked() && iscurrent) || (!isDocked())) && (checkBox->checkState() == Qt::Checked)) { populateAll(); } + working = false; } timerDisplay->display(value); } @@ -267,7 +270,7 @@ void StorStat::populateTerminated() p_tableitem->setBackground(Qt::green); else p_tableitem->setBackground(Qt::red); - } + } terminatedTable->setItem(row, column, p_tableitem); column += 1; }