diff options
author | David Robillard <d@drobilla.net> | 2009-05-30 16:28:44 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-05-30 16:28:44 +0000 |
commit | 11bf119232b528e4d4ef6efa754fb70706308861 (patch) | |
tree | ea57eaad4b3d7a70e3c4108c72d4329f4882cfc5 /src | |
parent | 8817e75517d83266cea3cf569a974909aa3dc8f2 (diff) | |
download | ingen-11bf119232b528e4d4ef6efa754fb70706308861.tar.gz ingen-11bf119232b528e4d4ef6efa754fb70706308861.tar.bz2 ingen-11bf119232b528e4d4ef6efa754fb70706308861.zip |
Fix crash when clearing patch that contains a patch (deactivate nodes on clear patch).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2050 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/events/ClearPatchEvent.cpp | 18 | ||||
-rw-r--r-- | src/engine/events/ClearPatchEvent.hpp | 2 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/engine/events/ClearPatchEvent.cpp b/src/engine/events/ClearPatchEvent.cpp index ccb84d48..3a016a66 100644 --- a/src/engine/events/ClearPatchEvent.cpp +++ b/src/engine/events/ClearPatchEvent.cpp @@ -74,6 +74,10 @@ ClearPatchEvent::pre_process() SharedPtr<PortImpl> port = PtrCast<PortImpl>(i->second); if (port) ++port_count; + + SharedPtr<NodeImpl> node = PtrCast<NodeImpl>(i->second); + if (node) + node->deactivate(); } _driver_ports = new DriverPorts(port_count, NULL); @@ -139,9 +143,13 @@ ClearPatchEvent::post_process() assert(_patch->num_ports() == 0); assert(_patch->connections().size() == 0); - // Reply - _responder->respond_ok(); - _engine.broadcaster()->send_clear_patch(_patch_path); + // Deactivate nodes + for (EngineStore::Objects::iterator i = _removed_table->begin(); + i != _removed_table->end(); ++i) { + SharedPtr<NodeImpl> node = PtrCast<NodeImpl>(i->second); + if (node) + node->deactivate(); + } // Unregister and destroy driver ports if (_driver_ports) { @@ -155,6 +163,10 @@ ClearPatchEvent::post_process() delete _driver_ports; } + // Reply + _responder->respond_ok(); + _engine.broadcaster()->send_clear_patch(_patch_path); + } else { _responder->respond_error(string("Patch ") + _patch_path.str() + " not found"); } diff --git a/src/engine/events/ClearPatchEvent.hpp b/src/engine/events/ClearPatchEvent.hpp index e121c423..4dc7dddb 100644 --- a/src/engine/events/ClearPatchEvent.hpp +++ b/src/engine/events/ClearPatchEvent.hpp @@ -54,7 +54,7 @@ private: typedef Raul::Array<Raul::List<DriverPort*>::Node*> DriverPorts; DriverPorts* _driver_ports; - SharedPtr< Raul::Table<Raul::Path, SharedPtr<Shared::GraphObject> > > _removed_table; + SharedPtr<EngineStore::Objects> _removed_table; }; |