diff --git a/src/QtLocationPlugin/QGCTileCacheWorker.cpp b/src/QtLocationPlugin/QGCTileCacheWorker.cpp index 7ccc034ee26f441014e727b2e3c858a60d7c7d18..0f847311dacce3841cb7e0bc1d45e9cd25978b87 100644 --- a/src/QtLocationPlugin/QGCTileCacheWorker.cpp +++ b/src/QtLocationPlugin/QGCTileCacheWorker.cpp @@ -188,18 +188,15 @@ QGCCacheWorker::run() //-- Wait a bit before shutting things down _waitmutex.lock(); int timeout = 5000; - if(!_waitc.wait(&_waitmutex, timeout)) - { - _waitmutex.unlock(); - _mutex.lock(); - //-- If nothing to do, close db and leave thread - if(!_taskQueue.count()) { - _mutex.unlock(); - break; - } + _waitc.wait(&_waitmutex, timeout); + _waitmutex.unlock(); + _mutex.lock(); + //-- If nothing to do, close db and leave thread + if(!_taskQueue.count()) { _mutex.unlock(); + break; } - _waitmutex.unlock(); + _mutex.unlock(); } } if(_db) {