summaryrefslogtreecommitdiffstats
path: root/src/server/events/CreateBlock.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-09-22 11:13:12 -0400
committerDavid Robillard <d@drobilla.net>2023-09-22 11:27:06 -0400
commit97f5ecf41bccbc6339a18c649cd7bfcd84b18312 (patch)
treeae717b716d76d30846ad1d8eb46967866ab6a140 /src/server/events/CreateBlock.cpp
parent3192ce81f9f87e4e56393dd539c95185c7ef306d (diff)
downloadingen-97f5ecf41bccbc6339a18c649cd7bfcd84b18312.tar.gz
ingen-97f5ecf41bccbc6339a18c649cd7bfcd84b18312.tar.bz2
ingen-97f5ecf41bccbc6339a18c649cd7bfcd84b18312.zip
Use a regular unique_ptr for compiled graphs
Since these are always swapped by events which already have the ability to delete things after execution (by deleting them along with the event itself after processing), we can avoid the complexity and overhead of Raul::managed_ptr here by swapping the old graph for the new, retaining the owning reference to the old CompiledGraph in the event.
Diffstat (limited to 'src/server/events/CreateBlock.cpp')
-rw-r--r--src/server/events/CreateBlock.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp
index aa4cb1c0..7f50411c 100644
--- a/src/server/events/CreateBlock.cpp
+++ b/src/server/events/CreateBlock.cpp
@@ -40,7 +40,6 @@
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
#include "ingen/paths.hpp"
-#include "raul/Maid.hpp"
#include "raul/Path.hpp"
#include "raul/Symbol.hpp"
@@ -169,7 +168,7 @@ CreateBlock::pre_process(PreProcessContext& ctx)
/* Compile graph with new block added for insertion in audio thread
TODO: Since the block is not connected at this point, a full compilation
could be avoided and the block simply appended. */
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_graph);
+ _compiled_graph = ctx.maybe_compile(*_graph);
_update.put_block(_block);
@@ -180,7 +179,8 @@ void
CreateBlock::execute(RunContext&)
{
if (_status == Status::SUCCESS && _compiled_graph) {
- _graph->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph =
+ _graph->swap_compiled_graph(std::move(_compiled_graph));
}
}