From 97f5ecf41bccbc6339a18c649cd7bfcd84b18312 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 22 Sep 2023 11:13:12 -0400 Subject: 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. --- src/server/events/Copy.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/server/events/Copy.cpp') diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index 24e7b339..4219cef2 100644 --- a/src/server/events/Copy.cpp +++ b/src/server/events/Copy.cpp @@ -136,7 +136,7 @@ Copy::engine_to_engine(PreProcessContext& ctx) _engine.store()->add(_block); // Compile graph with new block added for insertion in audio thread - _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_parent); + _compiled_graph = ctx.maybe_compile(*_parent); return Event::pre_process_done(Status::SUCCESS); } @@ -207,7 +207,8 @@ void Copy::execute(RunContext&) { if (_block && _compiled_graph) { - _parent->set_compiled_graph(std::move(_compiled_graph)); + _compiled_graph = + _parent->swap_compiled_graph(std::move(_compiled_graph)); } } -- cgit v1.2.1