From 935c0cc13710765520b29bad4d659eeeee4daced Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Nov 2015 16:39:23 -0800 Subject: [PATCH] handle AudioInjectorManager cleanup in Application --- interface/src/Application.cpp | 4 ++++ libraries/audio/src/AudioInjectorManager.cpp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 9bc0bf0179..6f3116ef9b 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -863,6 +863,10 @@ void Application::cleanupBeforeQuit() { // 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 diff --git a/libraries/audio/src/AudioInjectorManager.cpp b/libraries/audio/src/AudioInjectorManager.cpp index 33df3e4e94..a441f679d6 100644 --- a/libraries/audio/src/AudioInjectorManager.cpp +++ b/libraries/audio/src/AudioInjectorManager.cpp @@ -34,6 +34,12 @@ AudioInjectorManager::~AudioInjectorManager() { _injectors.pop(); } + // get rid of the lock now that we've stopped all living injectors + lock.unlock(); + + // in case the thread is waiting for injectors wake it up now + _injectorReady.notify_one(); + // quit and wait on the manager thread, if we ever created it if (_thread) { _thread->quit();