changeset 204:5ee9e6bc21eb

* Use a mutex when setting auditioning plugin; lifecycle management too fragile otherwise
author Chris Cannam
date Fri, 08 Oct 2010 11:19:57 +0100
parents aafbb79e93d4
children a3fbd52031a5
files audioio/AudioCallbackPlaySource.cpp
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp	Fri Oct 08 09:40:16 2010 +0100
+++ b/audioio/AudioCallbackPlaySource.cpp	Fri Oct 08 11:19:57 2010 +0100
@@ -962,10 +962,11 @@
     if (a && !plugin) {
         std::cerr << "WARNING: AudioCallbackPlaySource::setAuditioningEffect: auditionable object " << a << " is not a real-time plugin instance" << std::endl;
     }
-    RealTimePluginInstance *formerPlugin = m_auditioningPlugin;
+
+    m_mutex.lock();
     m_auditioningPlugin = plugin;
     m_auditioningPluginBypassed = false;
-    if (formerPlugin) m_pluginScavenger.claim(formerPlugin);
+    m_mutex.unlock();
 }
 
 void
@@ -1249,7 +1250,7 @@
     if (m_auditioningPluginBypassed) return;
     RealTimePluginInstance *plugin = m_auditioningPlugin;
     if (!plugin) return;
-
+    
     if (plugin->getAudioInputCount() != getTargetChannelCount()) {
 //        std::cerr << "plugin input count " << plugin->getAudioInputCount() 
 //                  << " != our channel count " << getTargetChannelCount()