diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 8d2421bb9f..fcfbe0f3b1 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1570,17 +1570,6 @@ void Application::cleanupBeforeQuit() { saveSettings(); _window->saveGeometry(); - // stop the AudioClient - QMetaObject::invokeMethod(DependencyManager::get().data(), - "stop", Qt::BlockingQueuedConnection); - - // destroy the AudioClient so it and its thread have a chance to go down safely - DependencyManager::destroy(); - - // destroy the AudioInjectorManager so it and its thread have a chance to go down safely - // this will also stop any ongoing network injectors - DependencyManager::destroy(); - // Destroy third party processes after scripts have finished using them. #ifdef HAVE_DDE DependencyManager::destroy(); @@ -1589,8 +1578,19 @@ void Application::cleanupBeforeQuit() { DependencyManager::destroy(); #endif + // stop QML DependencyManager::destroy(); + // stop audio after QML, as there are unexplained audio crashes originating in qtwebengine + + // stop the AudioClient, synchronously + QMetaObject::invokeMethod(DependencyManager::get().data(), + "stop", Qt::BlockingQueuedConnection); + + // destroy Audio so it and its threads have a chance to go down safely + DependencyManager::destroy(); + DependencyManager::destroy(); + // shutdown render engine _main3DScene = nullptr; _renderEngine = nullptr; @@ -1618,7 +1618,6 @@ Application::~Application() { DependencyManager::get()->getObjectsToRemoveFromPhysics(motionStates); _physicsEngine->removeObjects(motionStates); - DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy();