diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ab1a326698..bf83fdcde9 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -250,6 +250,9 @@ public: _heartbeat = usecTimestampNow(); }); heartbeatTimer->start(HEARTBEAT_UPDATE_INTERVAL_SECS * MSECS_PER_SECOND); + connect(qApp, &QCoreApplication::aboutToQuit, [this] { + _quit = true; + }); } void deadlockDetectionCrash() { @@ -258,7 +261,7 @@ public: } void run() override { - while (!qApp->isAboutToQuit()) { + while (!_quit) { QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS); auto now = usecTimestampNow(); auto lastHeartbeatAge = now - _heartbeat; @@ -269,6 +272,7 @@ public: } static std::atomic _heartbeat; + bool _quit { false }; }; std::atomic DeadlockWatchdogThread::_heartbeat;