Add a couple of function calls so that Ardour will perform some basic cleanup when...
authorJohn Emmas <johne53@tiscali.co.uk>
Tue, 15 Jul 2014 12:19:33 +0000 (13:19 +0100)
committerJohn Emmas <johne53@tiscali.co.uk>
Tue, 15 Jul 2014 12:19:33 +0000 (13:19 +0100)
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

index 8384eee20877f3ee480ec6af310fc3d138f395c3..9c602c57e2c558f9c127cba4aa97b4a0ee521123 100644 (file)
@@ -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;