From c4faafc0d3b9c68d41706ad40edde1ecfb7f4338 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 20 Sep 2007 22:17:10 +0000 Subject: Fix deletion of multiple nodes instead of just one (basically fix everything going to hell after deleting a node). git-svn-id: http://svn.drobilla.net/lad/ingen@743 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/events/DestroyEvent.cpp | 14 +++----------- src/libs/engine/events/DestroyEvent.hpp | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index 435894bd..ceb75816 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -40,6 +40,7 @@ DestroyEvent::DestroyEvent(Engine& engine, SharedPtr responder, Frame : QueuedEvent(engine, responder, time, source, source), _path(path), _store_iterator(engine.object_store()->objects().end()), + _removed_table(NULL), _node(NULL), _port(NULL), _driver_port(NULL), @@ -74,7 +75,7 @@ DestroyEvent::pre_process() } if (_store_iterator != _engine.object_store()->objects().end()) { - _table = _engine.object_store()->remove(_store_iterator); + _removed_table = _engine.object_store()->remove(_store_iterator); } if (_node != NULL && _path != "/") { @@ -86,19 +87,10 @@ DestroyEvent::pre_process() _disconnect_node_event = new DisconnectNodeEvent(_engine, _node); _disconnect_node_event->pre_process(); - //_node->remove_from_store(); - _engine.object_store()->remove(_store_iterator); - if (_node->parent_patch()->enabled()) { // FIXME: is this called multiple times? _compiled_patch = _node->parent_patch()->compile(); - // Remove node to be removed from the process order so it isn't executed by - // Patch::run and can safely be destroyed - //for (size_t i=0; i < _compiled_patch->size(); ++i) - // if (_compiled_patch->at(i) == _node) - // _compiled_patch->at(i) = NULL; // ew, gap - -#ifdef DEBUG +#ifndef NDEBUG // Be sure node is removed from process order, so it can be destroyed for (size_t i=0; i < _compiled_patch->size(); ++i) { assert(_compiled_patch->at(i).node() != _node); diff --git a/src/libs/engine/events/DestroyEvent.hpp b/src/libs/engine/events/DestroyEvent.hpp index ed4328f6..82024e90 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; - Table _table; + Table _removed_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; -- cgit v1.2.1