diff --git a/app/main.cpp b/app/main.cpp index 6629a752..7250bd76 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -381,8 +381,12 @@ int SDLCALL signalHandlerThread(void* data) _Exit(1); } - // If we're not streaming, we'll close the whole app - QCoreApplication::instance()->quit(); + // If we're not streaming, we'll close the whole app on the main thread + if (QCoreApplication* app = QCoreApplication::instance()) { + QMetaObject::invokeMethod(app, []() { + QCoreApplication::quit(); + }, Qt::QueuedConnection); + } requestedQuit = true; } break; diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index 3898c00f..75d30a1d 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -1307,7 +1307,11 @@ private: // Exit the entire program if requested if (m_Session->m_ShouldExit) { - QCoreApplication::instance()->quit(); + if (QCoreApplication* app = QCoreApplication::instance()) { + QMetaObject::invokeMethod(app, []() { + QCoreApplication::quit(); + }, Qt::QueuedConnection); + } } }