From 72c6d069df26396436c653532702a4f96f901fba Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 20 Dec 2008 19:00:33 +0000 Subject: Fix race condition on clear patch. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1876 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/PatchImpl.cpp | 6 +++--- src/engine/events/ClearPatchEvent.cpp | 2 +- src/engine/events/DestroyEvent.cpp | 4 ++-- src/engine/events/DestroyEvent.hpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/engine/PatchImpl.cpp b/src/engine/PatchImpl.cpp index 443ec4a4..cbf5c194 100644 --- a/src/engine/PatchImpl.cpp +++ b/src/engine/PatchImpl.cpp @@ -304,7 +304,7 @@ PatchImpl::remove_connection(const PortImpl* src_port, const PortImpl* dst_port) } if ( ! found) - cerr << "WARNING: [PatchImpl::remove_connection] Connection not found !" << endl; + cerr << "WARNING: [PatchImpl::remove_connection] Connection not found" << endl; return connection; } @@ -382,7 +382,7 @@ PatchImpl::remove_port(const string& symbol) } if ( ! found) - cerr << "WARNING: [PatchImpl::remove_port] Port not found !" << endl; + cerr << "WARNING: [PatchImpl::remove_port] Port not found!" << endl; return ret; } @@ -398,7 +398,7 @@ PatchImpl::remove_port(const string& symbol) void PatchImpl::clear_ports() { - assert(ThreadManager::current_thread_id() == THREAD_PROCESS); + assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); _input_ports.clear(); _output_ports.clear(); diff --git a/src/engine/events/ClearPatchEvent.cpp b/src/engine/events/ClearPatchEvent.cpp index c180e5fa..7dfdbc3e 100644 --- a/src/engine/events/ClearPatchEvent.cpp +++ b/src/engine/events/ClearPatchEvent.cpp @@ -56,6 +56,7 @@ ClearPatchEvent::pre_process() _removed_table = _engine.engine_store()->remove_children(patch_iterator); _patch->nodes().clear(); _patch->connections().clear(); + _patch->clear_ports(); _ports_array = _patch->build_ports_array(); if (_patch->enabled()) _compiled_patch = _patch->compile(); @@ -79,7 +80,6 @@ ClearPatchEvent::execute(ProcessContext& context) _patch->compiled_patch(NULL); } - _patch->clear_ports(); _patch->connections().clear(); _patch->compiled_patch(_compiled_patch); Raul::Array* old_ports = _patch->external_ports(); diff --git a/src/engine/events/DestroyEvent.cpp b/src/engine/events/DestroyEvent.cpp index 17552938..c1ee15e7 100644 --- a/src/engine/events/DestroyEvent.cpp +++ b/src/engine/events/DestroyEvent.cpp @@ -34,8 +34,8 @@ namespace Ingen { -DestroyEvent::DestroyEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& path, bool block) - : QueuedEvent(engine, responder, time, source, source) +DestroyEvent::DestroyEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& path) + : QueuedEvent(engine, responder, time, true, source) , _path(path) , _store_iterator(engine.engine_store()->end()) , _driver_port(NULL) diff --git a/src/engine/events/DestroyEvent.hpp b/src/engine/events/DestroyEvent.hpp index 1876050d..c260a480 100644 --- a/src/engine/events/DestroyEvent.hpp +++ b/src/engine/events/DestroyEvent.hpp @@ -49,7 +49,7 @@ class CompiledPatch; class DestroyEvent : public QueuedEvent { public: - DestroyEvent(Engine& engine, SharedPtr responder, FrameTime timestamp, QueuedEventSource* source, const string& path, bool block = true); + DestroyEvent(Engine& engine, SharedPtr responder, FrameTime timestamp, QueuedEventSource* source, const string& path); ~DestroyEvent(); void pre_process(); -- cgit v1.2.1