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.
#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"
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;