fix problem with ArdourDialog::on_delete_event() not being called when appropriate during app startup

The dialog is run using gtk_dialog_run() which uses on_response() to deal with delete/close events unlike a regular
top level event loop.

Probably even better would be run run the dialog from the top level event loop, but this is a bit complex
This commit is contained in:
Paul Davis 2019-09-22 21:45:30 -06:00
parent 80692dd36b
commit 9c0beeb759
2 changed files with 20 additions and 2 deletions

View File

@ -3101,13 +3101,30 @@ EngineControl::use_latency_button_clicked ()
}
}
void
EngineControl::on_response (int rid)
{
/* this gets called if this Dialog is running under gtk_dialog_run()
rather than in the toplevel loop. This happens during program
startup.
*/
if (rid == RESPONSE_DELETE_EVENT) {
on_delete_event ((GdkEventAny*) 0);
return;
}
ArdourDialog::on_response (rid);
}
bool
EngineControl::on_delete_event (GdkEventAny* ev)
{
if (notebook.get_current_page() == 2) {
/* currently on latency tab - be sure to clean up */
if (lm_running || notebook.get_current_page() == 2) {
/* currently measuring latency - be sure to clean up */
end_latency_detection ();
}
return ArdourDialog::on_delete_event (ev);
}

View File

@ -353,6 +353,7 @@ private:
void on_switch_page (GtkNotebookPage*, guint page_num);
bool on_delete_event (GdkEventAny*);
void on_response (int);
void engine_running ();
void engine_stopped ();