From eba00287cd9600e328ed0dd1bfed3bd9a7fa5da3 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 5 Oct 2023 12:57:16 -0600 Subject: [PATCH] fix SNAFU with ordering of adding stripables and selecting them when Session emits RouteAdded, each handler (editor, mixer, trigger pages etc) will execute their callbacks in order. But Editor::add_routes() selects the routes too, which triggers a PresentationInfo::Change signal. This is received by e.g. the Mixer before it has even found out about the newly added stripables. This in turn leads to severe confusion regarding the state of the selection in the mixer, and potentially elsewhere. So, just add a PresentationInfo::ChangeSuspender for the scope of the RouteAdde signal emission --- libs/ardour/session.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 639683b30c..bb2ff510f2 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -3256,6 +3256,11 @@ Session::add_routes (RouteList& new_routes, bool input_auto_connect, bool output update_route_record_state (); + /* Nobody should hear about changes to PresentationInfo + * (e.g. selection) until all handlers of RouteAdded have executed + */ + + PresentationInfo::ChangeSuspender cs; RouteAdded (new_routes); /* EMIT SIGNAL */ }