From fe744885613d4f91bf506c7a0b6243e7fa4150b5 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 10 Oct 2019 15:24:20 -0600 Subject: make ARDOUR_UI::load_session_from_startup_fsm() return a value, and use it --- gtk2_ardour/ardour_ui.h | 2 +- gtk2_ardour/ardour_ui_startup.cc | 33 +++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 15 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 13a5092baa..78cad3506b 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -225,7 +225,7 @@ public: void session_dialog_response_handler (int response, SessionDialog* session_dialog); int build_session_from_dialog (SessionDialog&, const std::string& session_name, const std::string& session_path); bool ask_about_loading_existing_session (const std::string& session_path); - void load_session_from_startup_fsm (); + int load_session_from_startup_fsm (); /// @return true if session was successfully unloaded. int unload_session (bool hide_stuff = false); diff --git a/gtk2_ardour/ardour_ui_startup.cc b/gtk2_ardour/ardour_ui_startup.cc index e89e5a2f11..2b0eadc405 100644 --- a/gtk2_ardour/ardour_ui_startup.cc +++ b/gtk2_ardour/ardour_ui_startup.cc @@ -484,13 +484,21 @@ ARDOUR_UI::sfsm_response (StartupFSM::Result r) { switch (r) { case StartupFSM::ExitProgram: + cerr << "ExitProgram\n"; queue_finish (); break; case StartupFSM::LoadSession: + cerr << "LoadSession\n"; _initial_verbose_plugin_scan = false; - load_session_from_startup_fsm (); + if (load_session_from_startup_fsm () == 0) { + startup_fsm->end(); + delete startup_fsm; + startup_fsm = 0; + startup_done (); + } break; case StartupFSM::DoNothing: + cerr << "DoNothing\n"; break; } } @@ -532,35 +540,32 @@ ARDOUR_UI::starting () return 0; } -void +int ARDOUR_UI::load_session_from_startup_fsm () { - string session_path = startup_fsm->session_path; - string session_name = startup_fsm->session_name; - string session_template = startup_fsm->session_template; - bool session_is_new = startup_fsm->session_is_new; - BusProfile bus_profile = startup_fsm->bus_profile; + const string session_path = startup_fsm->session_path; + const string session_name = startup_fsm->session_name; + const string session_template = startup_fsm->session_template; + const bool session_is_new = startup_fsm->session_is_new; + const BusProfile bus_profile = startup_fsm->bus_profile; std::cerr << " loading from " << session_path << " as " << session_name << " templ " << session_template << " is_new " << session_is_new << " bp " << bus_profile.master_out_channels << std::endl; if (session_is_new) { if (build_session (session_path, session_name, &bus_profile)) { + return -1; } if (!session_template.empty() && session_template.substr (0, 11) == "urn:ardour:") { meta_session_setup (session_template.substr (11)); } - } else { + return 0; + } - int ret = load_session (session_path, session_name, session_template); + return load_session (session_path, session_name, session_template); - if (ret == -2) { - /* not connected to the AudioEngine, so quit to avoid an infinite loop */ - exit (EXIT_FAILURE); - } - } } void -- cgit v1.2.3