summaryrefslogtreecommitdiffstats
path: root/src/libs/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/engine')
-rw-r--r--src/libs/engine/GraphObjectImpl.hpp2
-rw-r--r--src/libs/engine/NodeBase.cpp4
-rw-r--r--src/libs/engine/ObjectStore.cpp12
-rw-r--r--src/libs/engine/ObjectStore.hpp4
-rw-r--r--src/libs/engine/PatchImpl.cpp11
-rw-r--r--src/libs/engine/events/DestroyEvent.cpp1
-rw-r--r--src/libs/engine/events/DestroyEvent.hpp2
-rw-r--r--src/libs/engine/events/RenameEvent.cpp10
8 files changed, 18 insertions, 28 deletions
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<Path, SharedPtr<Shared::GraphObject> >& table)
* Returned is a vector containing all descendants of the object removed
* including the object itself, in lexicographically sorted order by Path.
*/
-Table<Path, SharedPtr<Shared::GraphObject> >
+SharedPtr< Table<Path, SharedPtr<Shared::GraphObject> > >
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<Path, SharedPtr<Shared::GraphObject> >
+SharedPtr< Table<Path, SharedPtr<Shared::GraphObject> > >
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<Path, SharedPtr<Shared::GraphObject> > removed = _objects.yank(object, descendants_end);
- for (Objects::iterator i = removed.begin(); i != removed.end(); ++i) {
+ SharedPtr< Table<Path, SharedPtr<Shared::GraphObject> > > 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<Objects>();
}
}
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<Path, SharedPtr<Shared::GraphObject> >& family);
//void add(TreeNode<GraphObjectImpl*>* o);
- Table<Path, SharedPtr<Shared::GraphObject> > remove(const Path& path);
- Table<Path, SharedPtr<Shared::GraphObject> > remove(Objects::iterator i);
+ SharedPtr< Table<Path, SharedPtr<Shared::GraphObject> > > remove(const Path& path);
+ SharedPtr< Table<Path, SharedPtr<Shared::GraphObject> > > 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<NodeImpl*>::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> 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<Path, SharedPtr<Shared::GraphObject> > _removed_table;
+ SharedPtr< Table<Path, SharedPtr<Shared::GraphObject> > > _removed_table;
SharedPtr<NodeImpl> _node; ///< Non-NULL iff a node
SharedPtr<PortImpl> _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<Path, SharedPtr<Shared::GraphObject> > removed = _engine.object_store()->remove(_store_iterator);
- assert(removed.size() > 0);
+ SharedPtr< Table<Path, SharedPtr<Shared::GraphObject> > > removed
+ = _engine.object_store()->remove(_store_iterator);
+
+ assert(removed->size() > 0);
- for (Table<Path, SharedPtr<Shared::GraphObject> >::iterator i = removed.begin(); i != removed.end(); ++i) {
+ for (Table<Path, SharedPtr<Shared::GraphObject> >::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();
}