Guard for AudioInjectorManager existance; clear an audio interface pointer

This commit is contained in:
Simon Walton 2019-07-24 14:51:41 -07:00
parent 8b2c935f92
commit 53cf915e8d
2 changed files with 7 additions and 2 deletions

View file

@ -2824,6 +2824,7 @@ void Application::cleanupBeforeQuit() {
// destroy Audio so it and its threads have a chance to go down safely
// this must happen after QML, as there are unexplained audio crashes originating in qtwebengine
AudioInjector::setLocalAudioInterface(nullptr);
DependencyManager::destroy<AudioClient>();
DependencyManager::destroy<AudioScriptingInterface>();

View file

@ -33,5 +33,9 @@ ScriptAudioInjector::ScriptAudioInjector(const AudioInjectorPointer& injector) :
}
ScriptAudioInjector::~ScriptAudioInjector() {
DependencyManager::get<AudioInjectorManager>()->stop(_injector);
}
const auto audioInjectorManager = DependencyManager::get<AudioInjectorManager>();
// AudioInjectorManager may have been destroyed on application shutdown.
if (audioInjectorManager) {
audioInjectorManager->stop(_injector);
}
}