]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/status/clientstat.cpp
Prevent timer recursion in bat
[bacula/bacula] / bacula / src / qt-console / status / clientstat.cpp
index 37b98315fde14918176157611b7ce80293c4b6be..b36b22bf58842d4bfcef71001b46a95b3596eb37 100644 (file)
@@ -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 <QTableWidgetItem>
 #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()