fix possible deadlock replacing processor state.
authorRobin Gareus <robin@gareus.org>
Thu, 2 Jun 2016 17:33:39 +0000 (19:33 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 2 Jun 2016 20:25:41 +0000 (22:25 +0200)
libs/ardour/route.cc

index 5f98fba1fe47cf3a21b294fab37e65f482698c32..5a0959f8bba6fb49728289439c4afcc0e340b5c5 100644 (file)
@@ -2826,9 +2826,14 @@ Route::set_processor_state (const XMLNode& node)
        }
 
        {
-               Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ());
                Glib::Threads::RWLock::WriterLock lm (_processor_lock);
+               /* re-assign _processors w/o process-lock.
+                * if there's an IO-processor present in _processors but
+                * not in new_order, it will be deleted and ~IO takes
+                * a process lock.
+                */
                _processors = new_order;
+               Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ());
 
                if (must_configure) {
                        configure_processors_unlocked (0, &lm);