Keep the instance in static variable

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-04-05 21:16:25 -07:00
parent f869ce51b4
commit f16a3a1709

View file

@ -37,13 +37,16 @@ extern "C" int gitProgressCB(int percent, const char *text)
static QElapsedTimer timer; static QElapsedTimer timer;
static qint64 lastTime = 0; static qint64 lastTime = 0;
static int lastPercent = -100; static int lastPercent = -100;
static QMLManager *self;
if (!self)
self = QMLManager::instance();
if (!timer.isValid() || percent == 0) { if (!timer.isValid() || percent == 0) {
timer.restart(); timer.restart();
lastTime = 0; lastTime = 0;
lastPercent = -100; lastPercent = -100;
} }
QMLManager *self = QMLManager::instance();
if (self) { if (self) {
qint64 elapsed = timer.elapsed(); qint64 elapsed = timer.elapsed();
// don't show the same status twice in 200ms // don't show the same status twice in 200ms