summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-12-13 18:05:09 -0500
committerDavid Robillard <d@drobilla.net>2016-12-14 01:10:30 -0500
commit05c55a5be68318d2b7ca861a3012bf4893bcb82d (patch)
tree890af008d01e46f15fb3e15accbcd53f0b8de675
parent4df8895cf62db13f03ad7165c9d2b1060b04de4c (diff)
downloadingen-05c55a5be68318d2b7ca861a3012bf4893bcb82d.tar.gz
ingen-05c55a5be68318d2b7ca861a3012bf4893bcb82d.tar.bz2
ingen-05c55a5be68318d2b7ca861a3012bf4893bcb82d.zip
Remove some use of shared_ptr in the real-time thread
-rw-r--r--src/server/events/CreateGraph.cpp34
-rw-r--r--src/server/events/CreateGraph.hpp4
2 files changed, 22 insertions, 16 deletions
diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp
index 40f539f7..a59aadc6 100644
--- a/src/server/events/CreateGraph.cpp
+++ b/src/server/events/CreateGraph.cpp
@@ -45,6 +45,15 @@ CreateGraph::CreateGraph(Engine& engine,
, _compiled_graph(NULL)
{}
+CreateGraph::~CreateGraph()
+{
+ for (Event* ev : _child_events) {
+ delete ev;
+ }
+
+ delete _compiled_graph;
+}
+
void
CreateGraph::build_child_events()
{
@@ -70,11 +79,10 @@ CreateGraph::build_child_events()
Resource::Graph::EXTERNAL);
_child_events.push_back(
- SPtr<Events::CreatePort>(
- new Events::CreatePort(
- _engine, _request_client, -1, _time,
- _path.child(Raul::Symbol("control")),
- in_properties)));
+ new Events::CreatePort(
+ _engine, _request_client, -1, _time,
+ _path.child(Raul::Symbol("control")),
+ in_properties));
// Add notify port (message respond)
Resource::Properties out_properties(control_properties);
@@ -87,10 +95,9 @@ CreateGraph::build_child_events()
Resource::Graph::EXTERNAL);
_child_events.push_back(
- SPtr<Events::CreatePort>(
- new Events::CreatePort(_engine, _request_client, -1, _time,
- _path.child(Raul::Symbol("notify")),
- out_properties)));
+ new Events::CreatePort(_engine, _request_client, -1, _time,
+ _path.child(Raul::Symbol("notify")),
+ out_properties));
}
bool
@@ -182,7 +189,7 @@ CreateGraph::pre_process(PreProcessContext& ctx)
// Build and pre-process child events to create standard ports
build_child_events();
- for (SPtr<Event> ev : _child_events) {
+ for (Event* ev : _child_events) {
ev->pre_process(ctx);
}
@@ -197,7 +204,7 @@ CreateGraph::execute(RunContext& context)
_compiled_graph = _parent->swap_compiled_graph(_compiled_graph);
}
- for (SPtr<Event> ev : _child_events) {
+ for (Event* ev : _child_events) {
ev->execute(context);
}
}
@@ -212,13 +219,10 @@ CreateGraph::post_process()
}
if (_graph) {
- for (SPtr<Event> ev : _child_events) {
+ for (Event* ev : _child_events) {
ev->post_process();
}
}
- _child_events.clear();
-
- delete _compiled_graph;
}
void
diff --git a/src/server/events/CreateGraph.hpp b/src/server/events/CreateGraph.hpp
index 794742ac..7eee9c08 100644
--- a/src/server/events/CreateGraph.hpp
+++ b/src/server/events/CreateGraph.hpp
@@ -44,6 +44,8 @@ public:
const Raul::Path& path,
const Resource::Properties& properties);
+ ~CreateGraph();
+
bool pre_process(PreProcessContext& ctx);
void execute(RunContext& context);
void post_process();
@@ -60,7 +62,7 @@ private:
GraphImpl* _graph;
GraphImpl* _parent;
CompiledGraph* _compiled_graph;
- std::list< SPtr<Event> > _child_events;
+ std::list<Event*> _child_events;
};
} // namespace Events