From c7f3a28390e651e03a68b664086351788a6a2d73 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 10 Oct 2007 05:45:04 +0000 Subject: Fix recursive patch problems (all objects recursively appearing as direct child of root). Use slightly more human friendly names for blank nodes in patch files. Fix memory management semantics of engine side objects (fix crash on subpatch delete). Make Raul::Table a boost::noncopyable; related changes trickled down from that. git-svn-id: http://svn.drobilla.net/lad/ingen@865 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/GraphObjectImpl.hpp | 2 ++ src/libs/engine/NodeBase.cpp | 4 ---- src/libs/engine/ObjectStore.cpp | 12 +++++++----- src/libs/engine/ObjectStore.hpp | 4 ++-- src/libs/engine/PatchImpl.cpp | 11 ----------- src/libs/engine/events/DestroyEvent.cpp | 1 - src/libs/engine/events/DestroyEvent.hpp | 2 +- src/libs/engine/events/RenameEvent.cpp | 10 ++++++---- 8 files changed, 18 insertions(+), 28 deletions(-) (limited to 'src/libs/engine') diff --git a/src/libs/engine/GraphObjectImpl.hpp b/src/libs/engine/GraphObjectImpl.hpp index 3862c762..dc833b08 100644 --- a/src/libs/engine/GraphObjectImpl.hpp +++ b/src/libs/engine/GraphObjectImpl.hpp @@ -55,6 +55,8 @@ public: bool polyphonic() const { return _polyphonic; } virtual void set_polyphonic(Raul::Maid& maid, bool p) { _polyphonic = p; } + GraphObject* graph_parent() const { return _parent; } + inline GraphObjectImpl* parent() const { return _parent; } const string name() const { return _name; } diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp index 2d0adabc..ca5d1fc0 100644 --- a/src/libs/engine/NodeBase.cpp +++ b/src/libs/engine/NodeBase.cpp @@ -60,10 +60,6 @@ NodeBase::~NodeBase() delete _providers; delete _dependants; - - if (_ports) - for (uint32_t i=0; i < num_ports(); ++i) - delete _ports->at(i); } diff --git a/src/libs/engine/ObjectStore.cpp b/src/libs/engine/ObjectStore.cpp index 2eff21b0..e8fa3f4d 100644 --- a/src/libs/engine/ObjectStore.cpp +++ b/src/libs/engine/ObjectStore.cpp @@ -113,7 +113,7 @@ ObjectStore::add(const Table >& table) * Returned is a vector containing all descendants of the object removed * including the object itself, in lexicographically sorted order by Path. */ -Table > +SharedPtr< Table > > ObjectStore::remove(const Path& path) { return remove(_objects.find(path)); @@ -125,7 +125,7 @@ ObjectStore::remove(const Path& path) * Returned is a vector containing all descendants of the object removed * including the object itself, in lexicographically sorted order by Path. */ -Table > +SharedPtr< Table > > ObjectStore::remove(Objects::iterator object) { assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); @@ -133,8 +133,10 @@ ObjectStore::remove(Objects::iterator object) if (object != _objects.end()) { Objects::iterator descendants_end = _objects.find_descendants_end(object); //cout << "[ObjectStore] Removing " << object->first << " {" << endl; - Table > removed = _objects.yank(object, descendants_end); - for (Objects::iterator i = removed.begin(); i != removed.end(); ++i) { + SharedPtr< Table > > removed + = _objects.yank(object, descendants_end); + + for (Objects::iterator i = removed->begin(); i != removed->end(); ++i) { cout << "\t" << i->first << endl; } cout << "}" << endl; @@ -143,7 +145,7 @@ ObjectStore::remove(Objects::iterator object) } else { cerr << "[ObjectStore] WARNING: Removing " << object->first << " failed." << endl; - return Objects(); + return SharedPtr(); } } diff --git a/src/libs/engine/ObjectStore.hpp b/src/libs/engine/ObjectStore.hpp index cc83d85a..9c316f6c 100644 --- a/src/libs/engine/ObjectStore.hpp +++ b/src/libs/engine/ObjectStore.hpp @@ -60,8 +60,8 @@ public: void add(const Table >& family); //void add(TreeNode* o); - Table > remove(const Path& path); - Table > remove(Objects::iterator i); + SharedPtr< Table > > remove(const Path& path); + SharedPtr< Table > > remove(Objects::iterator i); const Objects& objects() const { return _objects; } Objects& objects() { return _objects; } diff --git a/src/libs/engine/PatchImpl.cpp b/src/libs/engine/PatchImpl.cpp index 3e4c78c7..9e2becae 100644 --- a/src/libs/engine/PatchImpl.cpp +++ b/src/libs/engine/PatchImpl.cpp @@ -54,17 +54,6 @@ PatchImpl::~PatchImpl() { assert(!_activated); - for (Connections::iterator i = _connections.begin(); i != _connections.end(); ++i) { - (*i).reset(); - delete _connections.erase(i); - } - - for (List::iterator i = _nodes.begin(); i != _nodes.end(); ++i) { - assert(!(*i)->activated()); - delete (*i); - delete _nodes.erase(i); - } - delete _compiled_patch; } diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index cf250f2f..59e6af5b 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -39,7 +39,6 @@ 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), _driver_port(NULL), _patch_node_listnode(NULL), _patch_port_listnode(NULL), diff --git a/src/libs/engine/events/DestroyEvent.hpp b/src/libs/engine/events/DestroyEvent.hpp index 10e59751..4a82c5bb 100644 --- a/src/libs/engine/events/DestroyEvent.hpp +++ b/src/libs/engine/events/DestroyEvent.hpp @@ -60,7 +60,7 @@ public: private: Path _path; ObjectStore::Objects::iterator _store_iterator; - Table > _removed_table; + SharedPtr< Table > > _removed_table; SharedPtr _node; ///< Non-NULL iff a node SharedPtr _port; ///< Non-NULL iff a port DriverPort* _driver_port; diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp index d0ef532a..1b563d11 100644 --- a/src/libs/engine/events/RenameEvent.cpp +++ b/src/libs/engine/events/RenameEvent.cpp @@ -77,10 +77,12 @@ RenameEvent::pre_process() return; } - Table > removed = _engine.object_store()->remove(_store_iterator); - assert(removed.size() > 0); + SharedPtr< Table > > removed + = _engine.object_store()->remove(_store_iterator); + + assert(removed->size() > 0); - for (Table >::iterator i = removed.begin(); i != removed.end(); ++i) { + for (Table >::iterator i = removed->begin(); i != removed->end(); ++i) { const Path& child_old_path = i->first; assert(Path::descendant_comparator(_old_path, child_old_path)); @@ -94,7 +96,7 @@ RenameEvent::pre_process() i->first = child_new_path; } - _engine.object_store()->add(removed); + _engine.object_store()->add(*removed.get()); QueuedEvent::pre_process(); } -- cgit v1.2.1