From 74ec58c12e3f214d5a8a1ad843d15fb36394a7ae Mon Sep 17 00:00:00 2001 From: John Emmas Date: Tue, 15 Jul 2014 13:19:33 +0100 Subject: [PATCH] Add a couple of function calls so that Ardour will perform some basic cleanup when the user exits Up until now we were relying on various d'tors to do this cleanup for us. However, because we were calling 'exit()' (to terminate the program) those d'tors were never getting called. We should probably review the use of exit() as a termination strategy. --- gtk2_ardour/ardour_ui.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 8384eee208..9c602c57e2 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -53,6 +53,7 @@ #include "pbd/stl_delete.h" #include "pbd/file_utils.h" #include "pbd/localtime_r.h" +#include "pbd/pthread_utils.h" #include "gtkmm2ext/application.h" #include "gtkmm2ext/bindings.h" @@ -2718,6 +2719,13 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri break; default: if (quit_on_cancel) { + // JE - Currently (July 2014) this section can only get reached if the + // user quits from the main 'Session Setup' dialog (i.e. reaching this + // point does NOT indicate an abnormal termination). Therefore, let's + // behave gracefully (i.e. let's do some cleanup) before we call exit() + ARDOUR::cleanup (); + pthread_cancel_all (); + exit (1); } else { return ret;