cleanup qml before audio

This commit is contained in:
Zach Pomerantz 2016-10-25 15:53:35 -07:00
parent 164955dc81
commit 5413d97089

View file

@ -1556,17 +1556,6 @@ void Application::cleanupBeforeQuit() {
saveSettings();
_window->saveGeometry();
// stop the AudioClient
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
"stop", Qt::BlockingQueuedConnection);
// destroy the AudioClient so it and its thread have a chance to go down safely
DependencyManager::destroy<AudioClient>();
// 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<AudioInjectorManager>();
// Destroy third party processes after scripts have finished using them.
#ifdef HAVE_DDE
DependencyManager::destroy<DdeFaceTracker>();
@ -1575,7 +1564,18 @@ void Application::cleanupBeforeQuit() {
DependencyManager::destroy<EyeTracker>();
#endif
// stop QML
DependencyManager::destroy<OffscreenUi>();
// stop audio after QML, as the qtwebengine may use it, and may crash if it is already stopped
// stop the AudioClient, synchronously
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
"stop", Qt::BlockingQueuedConnection);
// destroy Audio so it and its threads have a chance to go down safely
DependencyManager::destroy<AudioClient>();
DependencyManager::destroy<AudioInjectorManager>();
}
Application::~Application() {
@ -1596,7 +1596,6 @@ Application::~Application() {
DependencyManager::get<AvatarManager>()->getObjectsToRemoveFromPhysics(motionStates);
_physicsEngine->removeObjects(motionStates);
DependencyManager::destroy<OffscreenUi>();
DependencyManager::destroy<AvatarManager>();
DependencyManager::destroy<AnimationCache>();
DependencyManager::destroy<FramebufferCache>();