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/client/ObjectModel.hpp | 2 ++ src/libs/client/Store.cpp | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/libs/client') diff --git a/src/libs/client/ObjectModel.hpp b/src/libs/client/ObjectModel.hpp index f9be4fa6..586ef8b3 100644 --- a/src/libs/client/ObjectModel.hpp +++ b/src/libs/client/ObjectModel.hpp @@ -68,6 +68,8 @@ public: const string name() const { return _path.name(); } SharedPtr parent() const { return _parent; } bool polyphonic() const { return _polyphonic; } + + GraphObject* graph_parent() const { return _parent.get(); } const_iterator children_begin() const; const_iterator children_end() const; diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index ab2ea280..b118b4e4 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -272,7 +272,9 @@ Store::remove_object(const Path& path) assert(result); //_objects.erase(i); Objects::iterator descendants_end = _objects.find_descendants_end(i); - Table > removed = _objects.yank(i, descendants_end); + SharedPtr< Table > > removed + = _objects.yank(i, descendants_end); + /*cout << "[Store] Removing " << i->first << " {" << endl; for (Objects::iterator i = removed.begin(); i != removed.end(); ++i) { cout << "\t" << i->first << endl; @@ -365,11 +367,12 @@ Store::rename_event(const Path& old_path, const Path& new_path) Objects::iterator descendants_end = _objects.find_descendants_end(parent); - Table > removed = _objects.yank(parent, descendants_end); + SharedPtr< Table > > removed + = _objects.yank(parent, descendants_end); - assert(removed.size() > 0); + 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)); @@ -384,7 +387,7 @@ Store::rename_event(const Path& old_path, const Path& new_path) i->first = child_new_path; } - _objects.cram(removed); + _objects.cram(*removed.get()); //cerr << "[Store] Table:" << endl; //for (size_t i=0; i < removed.size(); ++i) { @@ -482,7 +485,8 @@ Store::patch_cleared_event(const Path& path) SharedPtr patch = PtrCast(object(path)); if (patch) for (ObjectModel::const_iterator i = patch->children_begin(); i != patch->children_end(); ++i) - destruction_event(i->second->path()); + if (i->second->graph_parent() == patch.get()) + destruction_event(i->second->path()); } -- cgit v1.2.1