From a3a30e39dffc902232bf3d3301b2ec0a707b6048 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 3 Apr 2023 15:45:18 +0200 Subject: [PATCH] Fix silent stem export channels (#9294) When toggling a channel-configs the following happens: 1. TrackExportChannelSelector::update_config 2. ExportProfileManager::clear_channel_configs 3. RouteExportChannel::create_from_route [...] CriticalSelectionChanged 4. ExportDialog::update_warnings_and_example_filename 5. ARDOUR::ExportProfileManager::get_warnings 6. ARDOUR::ExportProfileManager::build_filenames 7. ARDOUR::ExportFilename::set_channel_config [...] Step 3 creates a RouteExportChannel, Step 7 retains a shared-pointer to it in the config's ExportFilenamePtr. When toggling another channel: step 2 release the reference and step 3 creates a new RouteExportChannel. This new channel reuses the existing Route::_capture_processor (!). Now Step 7 releases the first RouteExportChannel in order to get_warnings for the new one. Since ExportFilenamePtr holds the the last reference, the d'tor of RouteExportChannel runs, which removes the capture-processor from the route. The newly created RouteExportChannel now has a reference to a CaptureProcessor that is not in the signal-flow. Note: the order of adding/removing RouteExportChannel matters. With a two track session: * Disable "with track/bus processing * Enable Track 1 * Enable Track 2 * Disable Track 1 * Enable Track 1 // << Track 2 becomes silent --- libs/ardour/export_profile_manager.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc index 116b88333e..3765ac6ccc 100644 --- a/libs/ardour/export_profile_manager.cc +++ b/libs/ardour/export_profile_manager.cc @@ -1076,6 +1076,11 @@ ExportProfileManager::build_filenames (std::list& result, ExportFil result.push_back (filename->get_path (format)); } } + /* no not retain the channel config - otherwise this retains + * Route::_capturing_processor that may already be removed + * from the processor chain. + */ + filename->set_channel_config (ExportChannelConfigPtr()); } };