summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-12-20 19:00:33 +0000
committerDavid Robillard <d@drobilla.net>2008-12-20 19:00:33 +0000
commit72c6d069df26396436c653532702a4f96f901fba (patch)
tree2a766dae4b1fc88bd29eaaa5c854ceae71469adf
parentbdc0651e0b5407d88f821329c9275625956f96d2 (diff)
downloadingen-72c6d069df26396436c653532702a4f96f901fba.tar.gz
ingen-72c6d069df26396436c653532702a4f96f901fba.tar.bz2
ingen-72c6d069df26396436c653532702a4f96f901fba.zip
Fix race condition on clear patch.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1876 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/engine/PatchImpl.cpp6
-rw-r--r--src/engine/events/ClearPatchEvent.cpp2
-rw-r--r--src/engine/events/DestroyEvent.cpp4
-rw-r--r--src/engine/events/DestroyEvent.hpp2
4 files changed, 7 insertions, 7 deletions
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<PortImpl*>* 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> responder, FrameTime time, QueuedEventSource* source, const string& path, bool block)
- : QueuedEvent(engine, responder, time, source, source)
+DestroyEvent::DestroyEvent(Engine& engine, SharedPtr<Responder> 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> responder, FrameTime timestamp, QueuedEventSource* source, const string& path, bool block = true);
+ DestroyEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime timestamp, QueuedEventSource* source, const string& path);
~DestroyEvent();
void pre_process();