From 5ad2f9d1921f00d65292653e068258a41b5ec149 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 26 Feb 2021 09:05:52 +1300 Subject: [PATCH] Fix OSX crash on shutdown --- interface/src/Application.cpp | 2 ++ libraries/script-engine/src/ScriptEngine.cpp | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 06ce6c3d6c..eec1efbd99 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2989,6 +2989,8 @@ Application::~Application() { qInstallMessageHandler(LogHandler::verboseMessageHandler); #ifdef Q_OS_MAC + // 26 Feb 2021 - Tried re-enabling this call but OSX still crashes on exit. + // // 10/16/2019 - Disabling this call. This causes known crashes (A), and it is not // fully understood whether it might cause other unknown crashes (B). // diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index e553672b02..9fbf7a2801 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -470,7 +470,10 @@ void ScriptEngine::waitTillDoneRunning(bool shutdown) { // We should never be waiting (blocking) on our own thread assert(workerThread != QThread::currentThread()); -#ifdef Q_OS_MAC +#if 0 + // 26 Feb 2021 - Disabled this OSX-specific code because it causes OSX to crash on shutdown; without this code, OSX + // doesn't crash on shutdown. Qt 5.12.3 and Qt 5.15.2. + // // On mac, don't call QCoreApplication::processEvents() here. This is to prevent // [NSApplication terminate:] from prematurely destroying the static destructors // while we are waiting for the scripts to shutdown. We will pump the message