Fix opening sessions using the Finder (OSX)

The ShouldLoad() signal is handled by flush_pending(). This is the first
time that normal application flow can be interrupted in ::starting()
after app->ready().

This calls ::load_from_application_api(), which in turn calls
startup_fsm->handle_path(). This sets off the complete initalization
process, loading the session, and concludes with ::sfsm_response(),
where there is a call to `delete startup_fsm;`

Previously execution continued in StartupFSM::start() which caused a
crash.
This commit is contained in:
Robin Gareus 2020-06-12 22:08:04 +02:00
parent 650fd31332
commit cda2e004a8
2 changed files with 16 additions and 6 deletions

View File

@ -471,10 +471,11 @@ ARDOUR_UI::sfsm_response (StartupFSM::Result r)
case StartupFSM::LoadSession: case StartupFSM::LoadSession:
if (load_session_from_startup_fsm () == 0) { if (load_session_from_startup_fsm () == 0) {
startup_done ();
delete startup_fsm; delete startup_fsm;
startup_fsm = 0; startup_fsm = 0;
startup_done ();
} else { } else {
DEBUG_TRACE (DEBUG::GuiStartup, "FSM reset\n");
startup_fsm->reset (); startup_fsm->reset ();
} }
@ -519,6 +520,16 @@ ARDOUR_UI::starting ()
startup_fsm = new StartupFSM (*amd); startup_fsm = new StartupFSM (*amd);
startup_fsm->signal_response().connect (sigc::mem_fun (*this, &ARDOUR_UI::sfsm_response)); startup_fsm->signal_response().connect (sigc::mem_fun (*this, &ARDOUR_UI::sfsm_response));
/* allow signals to be handled, ShouldLoad() from flush-pending */
Splash::instance()->pop_front();
flush_pending ();
if (!startup_fsm) {
DEBUG_TRACE (DEBUG::GuiStartup, "Starting: SFSM was driven by flush-pending\n");
return 0;
}
/* Note: entire startup process could happen in this one call /* Note: entire startup process could happen in this one call
* if: * if:
* *
@ -788,6 +799,7 @@ ARDOUR_UI::load_from_application_api (const std::string& path)
* 3) no audio/MIDI setup required * 3) no audio/MIDI setup required
*/ */
Splash::instance()->pop_front();
startup_fsm->start (); startup_fsm->start ();
} }
} }

View File

@ -127,11 +127,6 @@ StartupFSM::queue_finish ()
void void
StartupFSM::start () StartupFSM::start ()
{ {
/* get the splash screen visible, if it isn't yet */
Splash::instance()->pop_front();
/* make it all happen on-screen */
ARDOUR_UI::instance()->flush_pending ();
DEBUG_TRACE (DEBUG::GuiStartup, string_compose (X_("State at startup: %1\n"), enum_2_string (_state))); DEBUG_TRACE (DEBUG::GuiStartup, string_compose (X_("State at startup: %1\n"), enum_2_string (_state)));
switch (_state) { switch (_state) {
@ -144,6 +139,9 @@ StartupFSM::start ()
case WaitingForSessionPath: case WaitingForSessionPath:
handle_waiting_for_session_path (); handle_waiting_for_session_path ();
break; break;
case WaitingForEngineParams:
start_audio_midi_setup ();
break;
default: default:
fatal << string_compose (_("Programming error: %1"), string_compose (X_("impossible starting state in StartupFSM (%1)"), enum_2_string (_state))) << endmsg; fatal << string_compose (_("Programming error: %1"), string_compose (X_("impossible starting state in StartupFSM (%1)"), enum_2_string (_state))) << endmsg;
std::cerr << string_compose (_("Programming error: %1"), string_compose (X_("impossible starting state in StartupFSM (%1)"), enum_2_string (_state))) << std::endl; std::cerr << string_compose (_("Programming error: %1"), string_compose (X_("impossible starting state in StartupFSM (%1)"), enum_2_string (_state))) << std::endl;