13
0

Fix missing calls to SessionHandlePtr::session_going_away()

Explicit calls to set_session(0) will disconnect the
callback to session_going_away(). So don't do that.
This commit is contained in:
Robin Gareus 2024-11-07 17:23:42 +01:00
parent 0f0006cebc
commit 19fc6e831b
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
29 changed files with 104 additions and 60 deletions

View File

@ -784,6 +784,7 @@ ApplicationBar::set_session (Session *s)
if (_basic_ui) {
delete _basic_ui;
_basic_ui = 0;
}
map_transport_state ();

View File

@ -125,7 +125,6 @@ ARDOUR_UI::set_session (Session *s)
update_sample_rate ();
if (!_session) {
WM::Manager::instance().set_session (s);
/* Session option editor cannot exist across change-of-session */
session_option_editor.drop_window ();
/* Ditto for AddVideoDialog */
@ -306,8 +305,6 @@ ARDOUR_UI::unload_session (bool hide_stuff, bool force_unload)
ActionManager::set_sensitive (ActionManager::session_sensitive_actions, false);
WM::Manager::instance().set_session ((ARDOUR::Session*) 0);
if (ARDOUR_UI::instance()->video_timeline) {
ARDOUR_UI::instance()->video_timeline->close_session();
}

View File

@ -112,6 +112,10 @@ RegionPropertiesBox::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
if (s) {
return;
}
length_clock.set_session (s);
start_clock.set_session (s);
}

View File

@ -197,6 +197,10 @@ AudioTriggerPropertiesBox::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
if (!s) {
return;
}
_length_clock.set_session (s);
_start_clock.set_session (s);
}

View File

@ -32,8 +32,11 @@ public:
BigTransportWindow ();
void set_session (ARDOUR::Session *s) {
ArdourWindow::set_session (s);
if (s) {
transport_ctrl.set_session (s);
}
}
protected:
void on_unmap ();

View File

@ -108,7 +108,12 @@ class CueBoxWidget : public FittedCanvasWidget, public ARDOUR::SessionHandlePtr
public:
CueBoxWidget (float w, float h);
void set_session (ARDOUR::Session* s) {ui->set_session(s); SessionHandlePtr::set_session(s);}
void set_session (ARDOUR::Session* s) {
SessionHandlePtr::set_session(s);
if (s) {
ui->set_session(s);
}
}
void on_map ();
void on_unmap ();

View File

@ -41,7 +41,10 @@ DspStatisticsWindow::~DspStatisticsWindow ()
void
DspStatisticsWindow::set_session (Session* s)
{
ArdourWindow::set_session (s);
if (s) {
ui->set_session (s);
}
}
void

View File

@ -1193,7 +1193,6 @@ void
Editor::set_session (Session *t)
{
SessionHandlePtr::set_session (t);
_trigger_clip_picker.set_session (_session);
section_marker_bar->clear (true);
@ -1206,6 +1205,7 @@ Editor::set_session (Session *t)
* before the visible state has been loaded from instant.xml */
_leftmost_sample = session_gui_extents().first.samples();
_trigger_clip_picker.set_session (_session);
_application_bar.set_session (_session);
nudge_clock->set_session (_session);
_summary->set_session (_session);
@ -5508,8 +5508,6 @@ Editor::session_going_away ()
}
track_views.clear ();
nudge_clock->set_session (0);
/* clear tempo/meter rulers */
remove_metric_marks ();
clear_marker_display ();

View File

@ -37,7 +37,9 @@ void
EditorLocations::set_session (ARDOUR::Session* s)
{
SessionHandlePtr::set_session (s);
if (s) {
_locations->set_session (s);
}
}
Widget&

View File

@ -354,13 +354,14 @@ void
ExportFormatDialog::set_session (ARDOUR::Session* s)
{
SessionHandlePtr::set_session (s);
silence_start_clock.set_session (s);
silence_end_clock.set_session (s);
if (!_session) {
return;
}
silence_start_clock.set_session (s);
silence_end_clock.set_session (s);
update_clock (silence_start_clock, silence_start);
update_clock (silence_end_clock, silence_end);

View File

@ -93,12 +93,13 @@ void
IOPluginWindow::set_session (Session* s)
{
ArdourWindow::set_session (s);
_box_pre.set_session (s);
_box_post.set_session (s);
if (!_session) {
return;
}
_box_pre.set_session (s);
_box_post.set_session (s);
refill ();
_session->IOPluginsChanged.connect (_session_connections, invalidator (*this), std::bind (&IOPluginWindow::refill, this), gui_context ());
}

View File

@ -214,6 +214,7 @@ LocationEditRow::set_session (Session *sess)
SessionHandlePtr::set_session (sess);
if (!_session) {
set_location (0);
return;
}
@ -1130,12 +1131,12 @@ LocationUI::set_session(ARDOUR::Session* s)
Location::start_changed.connect (_session_connections, invalidator (*this), std::bind (&LocationUI::start_changed, this, _1), gui_context());
_clock_group->set_clock_mode (clock_mode_from_session_instant_xml ());
} else {
_mode_set = false;
}
loop_edit_row.set_session (s);
punch_edit_row.set_session (s);
} else {
_mode_set = false;
}
refresh_location_list ();
}
@ -1152,12 +1153,6 @@ LocationUI::session_going_away()
loc_children.clear();
range_children.clear();
loop_edit_row.set_session (0);
loop_edit_row.set_location (0);
punch_edit_row.set_session (0);
punch_edit_row.set_location (0);
_mode_set = false;
SessionHandlePtr::session_going_away ();
@ -1240,8 +1235,10 @@ void
LocationUIWindow::set_session (Session *s)
{
ArdourWindow::set_session (s);
if (s) {
_ui.set_session (s);
_ui.show_all ();
}
}
void

View File

@ -75,7 +75,9 @@ void
MidiClipEditorBox::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
if (s) {
editor->set_session (s);
}
}
void

View File

@ -1278,15 +1278,15 @@ void
Mixer_UI::set_session (Session* sess)
{
SessionHandlePtr::set_session (sess);
_monitor_section.set_session (sess);
if (sess) {
_monitor_section.set_session (sess);
_group_tabs->set_session (sess);
_application_bar.set_session (_session);
if (_plugin_selector) {
_plugin_selector->set_session (_session);
}
_group_tabs->set_session (sess);
_application_bar.set_session (_session);
}
update_scene_buttons();

View File

@ -584,12 +584,13 @@ void
MonitorSection::set_session (Session* s)
{
RouteUI::set_session (s);
insert_box->set_session (_session);
Glib::RefPtr<ActionGroup> global_monitor_actions = ActionManager::get_action_group (X_("Monitor Section"));
if (_session) {
insert_box->set_session (_session);
/* These are not actually dependent on the Session, but they
* need to be set after construction, not during, and
* this is as good a place as any.

View File

@ -730,7 +730,9 @@ void
ClockOption::set_session (Session* s)
{
_session = s;
if (s) {
_clock.set_session (s);
}
}
/*--------------------------*/

View File

@ -2162,6 +2162,9 @@ void
PluginPinDialog::set_session (ARDOUR::Session *s)
{
SessionHandlePtr::set_session (s);
if (!s) {
return;
}
for (PluginPinWidgetList::iterator i = ppw.begin(); i != ppw.end(); ++i) {
(*i)->set_session (s);
}

View File

@ -928,6 +928,7 @@ PortMatrix::notebook_page_selected (GtkNotebookPage *, guint)
void
PortMatrix::session_going_away ()
{
SessionHandlePtr::session_going_away ();
_session = 0;
}

View File

@ -5113,6 +5113,9 @@ void
RCOptionEditor::set_session (Session *s)
{
SessionHandlePtr::set_session (s);
if (!s) {
return;
}
_transport_masters_widget.set_session (s);
}

View File

@ -396,13 +396,6 @@ RecorderUI::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
_ruler.set_session (s);
_duration_info_box.set_session (s);
_xrun_info_box.set_session (s);
_remain_info_box.set_session (s);
_application_bar.set_session (s);
_rec_group_tabs->set_session (s);
update_sensitivity ();
if (!_session) {
@ -411,6 +404,13 @@ RecorderUI::set_session (Session* s)
return;
}
_ruler.set_session (s);
_duration_info_box.set_session (s);
_xrun_info_box.set_session (s);
_remain_info_box.set_session (s);
_application_bar.set_session (s);
_rec_group_tabs->set_session (s);
XMLNode* node = ARDOUR_UI::instance()->recorder_settings();
set_state (*node, Stateful::loading_state_version);

View File

@ -133,6 +133,10 @@ SelectionPropertiesBox::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
if (!s) {
return;
}
_time_info_box->set_session(s);
#if SELECTION_PROPERTIES_BOX_TODO

View File

@ -279,14 +279,13 @@ SoundFileBox::set_session(Session* s)
{
SessionHandlePtr::set_session (s);
length_clock.set_session (s);
timecode_clock.set_session (s);
if (!_session) {
play_btn.set_sensitive (false);
stop_btn.set_sensitive (false);
auditioner_connections.drop_connections();
} else {
length_clock.set_session (s);
timecode_clock.set_session (s);
auditioner_connections.drop_connections();
if (_session->the_auditioner()) {
_session->AuditionActive.connect(auditioner_connections, invalidator (*this), std::bind (&SoundFileBox::audition_active, this, _1), gui_context());
@ -989,9 +988,9 @@ void
SoundFileBrowser::set_session (Session* s)
{
ArdourWindow::set_session (s);
preview.set_session (s);
if (_session) {
preview.set_session (s);
add_gain_meter ();
} else {
remove_gain_meter ();

View File

@ -272,9 +272,9 @@ void
ShuttleControl::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
_vari_dialog.set_session (_session);
if (_session) {
_vari_dialog.set_session (_session);
_session->add_controllable (_controllable);
_info_button.set_session (s);
_session->config.ParameterChanged.connect (_session_connections, MISSING_INVALIDATOR, std::bind (&ShuttleControl::parameter_changed, this, _1), gui_context());

View File

@ -206,18 +206,20 @@ TimeInfoBox::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
if (s) {
selection_start->set_session (s);
selection_end->set_session (s);
selection_length->set_session (s);
}
if (!with_punch_clock) {
return;
}
if (s) {
punch_start->set_session (s);
punch_end->set_session (s);
if (s) {
Location* punch = s->locations()->auto_punch_location ();
if (punch) {

View File

@ -671,7 +671,9 @@ void
TransportMastersWindow::set_session (ARDOUR::Session* s)
{
ArdourWindow::set_session (s);
if (s) {
w.set_session (s);
}
}
void

View File

@ -302,6 +302,11 @@ TriggerPage::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
if (!_session) {
_selection.clear ();
return;
}
_application_bar.set_session (_session);
_cue_box.set_session (s);
_trigger_clip_picker.set_session (s);
@ -310,11 +315,6 @@ TriggerPage::set_session (Session* s)
_trigger_region_list.set_session (s);
_trigger_route_list.set_session (s);
if (!_session) {
_selection.clear ();
return;
}
XMLNode* node = ARDOUR_UI::instance ()->trigger_page_settings ();
set_state (*node, Stateful::loading_state_version);

View File

@ -191,6 +191,9 @@ void
Manager::set_session (ARDOUR::Session* s)
{
SessionHandlePtr::set_session (s);
if (!s) {
return;
}
for (Windows::const_iterator i = _windows.begin(); i != _windows.end(); ++i) {
(*i)->set_session(s);
}

View File

@ -153,6 +153,9 @@ public:
void set_session(ARDOUR::Session *s) {
SessionHandlePtr::set_session (s);
if (!s) {
return;
}
ARDOUR::SessionHandlePtr* sp = session_handle ();
if (sp) {
sp->set_session (s);
@ -206,6 +209,9 @@ public:
void set_session(ARDOUR::Session *s) {
SessionHandlePtr::set_session (s);
if (!s) {
return;
}
ARDOUR::SessionHandlePtr* sp = session_handle ();
if (sp) {
sp->set_session (s);