13
0

Fix inconsistent session-check

under some circumstances, e.g. session-exit it is possible to to have
inconsistent information
    ARDOUR_UI::instance()->session_loaded == true
 && ARDOUR_UI::instance()->the_session() == NULL

This lead to a crash on MacOS/X. stopping the engine at exit may destory
an Aggregate Device, leading to DeviceListChanged which in turn updates
the engine-dialog..
 else if (ARDOUR_UI::instance()->session_loaded) {
   float active_sr = ARDOUR_UI::instance()->the_session()->nominal_sample_rate ();
This commit is contained in:
Robin Gareus 2018-12-06 02:23:09 +01:00
parent 2eae3b5cd1
commit bf874562ef
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -430,7 +430,7 @@ EngineControl::on_show ()
void
EngineControl::on_map ()
{
if (!ARDOUR_UI::instance()->session_loaded && !PublicEditor::_instance) {
if (!ARDOUR_UI::instance()->the_session () && !PublicEditor::_instance) {
set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL);
} else if (UIConfiguration::instance().get_all_floating_windows_are_dialogs()) {
set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
@ -816,7 +816,7 @@ EngineControl::update_sensitivity ()
if (get_popdown_string_count (sample_rate_combo) > 0) {
bool allow_to_set_rate = false;
if (!engine_running) {
if (!ARDOUR_UI::instance()->session_loaded) {
if (!ARDOUR_UI::instance()->the_session ()) {
// engine is not running, no session loaded -> anything goes.
allow_to_set_rate = true;
} else if (_desired_sample_rate > 0 && get_rate () != _desired_sample_rate) {
@ -1364,7 +1364,7 @@ EngineControl::set_samplerate_popdown_strings ()
if (!s.empty()) {
if (ARDOUR::AudioEngine::instance()->running()) {
sample_rate_combo.set_active_text (rate_as_string (backend->sample_rate()));
} else if (ARDOUR_UI::instance()->session_loaded) {
} else if (ARDOUR_UI::instance()->the_session ()) {
float active_sr = ARDOUR_UI::instance()->the_session()->nominal_sample_rate ();
if (std::find (sr.begin (), sr.end (), active_sr) == sr.end ()) {
@ -2684,13 +2684,13 @@ EngineControl::start_stop_button_clicked ()
if (ARDOUR::AudioEngine::instance()->running()) {
ARDOUR::AudioEngine::instance()->stop ();
} else {
if (!ARDOUR_UI::instance()->session_loaded) {
if (!ARDOUR_UI::instance()->the_session ()) {
pop_splash ();
hide ();
ARDOUR::GUIIdle ();
}
start_engine ();
if (!ARDOUR_UI::instance()->session_loaded) {
if (!ARDOUR_UI::instance()->the_session ()) {
ArdourDialog::on_response (RESPONSE_OK);
}
}
@ -3108,13 +3108,13 @@ EngineControl::connect_disconnect_click()
if (ARDOUR::AudioEngine::instance()->running()) {
stop_engine ();
} else {
if (!ARDOUR_UI::instance()->session_loaded) {
if (!ARDOUR_UI::instance()->the_session ()) {
pop_splash ();
hide ();
ARDOUR::GUIIdle ();
}
start_engine ();
if (!ARDOUR_UI::instance()->session_loaded) {
if (!ARDOUR_UI::instance()->the_session ()) {
ArdourDialog::on_response (RESPONSE_OK);
}
}