summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-26 19:27:48 +0000
committerDavid Robillard <d@drobilla.net>2007-07-26 19:27:48 +0000
commit057069ef9f2129e9f0d3bce9066d75c621282d17 (patch)
tree136a9d4b5c41edcf1fffa4160b41cf16a0cef72c /src/libs/engine/events
parentbee242f29045b82e50a4f112ac17f7e14344df78 (diff)
downloadingen-057069ef9f2129e9f0d3bce9066d75c621282d17.tar.gz
ingen-057069ef9f2129e9f0d3bce9066d75c621282d17.tar.bz2
ingen-057069ef9f2129e9f0d3bce9066d75c621282d17.zip
Fix destruction.
git-svn-id: http://svn.drobilla.net/lad/ingen@639 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/events')
-rw-r--r--src/libs/engine/events/DestroyEvent.cpp21
-rw-r--r--src/libs/engine/events/DestroyEvent.hpp2
2 files changed, 13 insertions, 10 deletions
diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp
index 91b12af0..acc4a86d 100644
--- a/src/libs/engine/events/DestroyEvent.cpp
+++ b/src/libs/engine/events/DestroyEvent.cpp
@@ -41,7 +41,6 @@ DestroyEvent::DestroyEvent(Engine& engine, SharedPtr<Shared::Responder> responde
: QueuedEvent(engine, responder, time, source, source),
_path(path),
_store_iterator(engine.object_store()->objects().end()),
- _object(NULL),
_node(NULL),
_port(NULL),
_driver_port(NULL),
@@ -90,15 +89,16 @@ DestroyEvent::pre_process()
//_object = _engine.object_store()->find_object(_path);
if (_store_iterator != _engine.object_store()->objects().end()) {
- _node = dynamic_cast<Node*>(_object);
+ _node = dynamic_cast<Node*>(_store_iterator->second);
if (!_node)
- _port = dynamic_cast<Port*>(_object);
+ _port = dynamic_cast<Port*>(_store_iterator->second);
}
//}
- if (_store_iterator != _engine.object_store()->objects().end())
- _engine.object_store()->remove(_store_iterator);
+ if (_store_iterator != _engine.object_store()->objects().end()) {
+ _table = _engine.object_store()->remove(_store_iterator);
+ }
if (_node != NULL && _path != "/") {
assert(_node->parent_patch());
@@ -198,13 +198,17 @@ DestroyEvent::post_process()
{
if (_source)
_source->unblock();
-
- if (_object == NULL) {
+
+ if (_store_iterator != _engine.object_store()->objects().end()) {
+ _engine.broadcaster()->send_destroyed(_path);
+ } else {
if (_path == "/")
_responder->respond_error("You can not destroy the root patch (/)");
else
_responder->respond_error("Could not find object to destroy");
- } else if (_patch_node_listnode) {
+ }
+
+ if (_patch_node_listnode) {
assert(_node);
_node->deactivate();
_responder->respond_ok();
@@ -227,7 +231,6 @@ DestroyEvent::post_process()
if (_driver_port)
delete _driver_port;
- //_engine.maid()->push(_driver_port);
}
diff --git a/src/libs/engine/events/DestroyEvent.hpp b/src/libs/engine/events/DestroyEvent.hpp
index 0a855951..70616ac1 100644
--- a/src/libs/engine/events/DestroyEvent.hpp
+++ b/src/libs/engine/events/DestroyEvent.hpp
@@ -61,7 +61,7 @@ public:
private:
Path _path;
ObjectStore::Objects::iterator _store_iterator;
- GraphObject* _object;
+ Table<Path,GraphObject*> _table;
Node* _node; ///< Same as _object if it is a Node, otherwise NULL
Port* _port; ///< Same as _object if it is a Port, otherwise NULL
DriverPort* _driver_port;