fix crash on OS X el capitan when using command line arguments
[ardour.git] / gtk2_ardour / ardour_ui.cc
index d5498a2fc69c728755a650e9883cd4a0478a5a27..62043ead74852bf084c661cf182f4f533ec549fb 100644 (file)
@@ -3125,7 +3125,19 @@ ARDOUR_UI::build_session_from_dialog (SessionDialog& sd, const std::string& sess
 void
 ARDOUR_UI::load_from_application_api (const std::string& path)
 {
+       /* OS X El Capitan (and probably later) now somehow passes the command
+          line arguments to an app via the openFile delegate protocol. Ardour 
+          already does its own command line processing, and having both
+          pathways active causes crashes. So, if the command line was already
+          set, do nothing here.
+       */
+
+       if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
+               return;
+       }
+
        ARDOUR_COMMAND_LINE::session_name = path;
+
        /* Cancel SessionDialog if it's visible to make OSX delegates work.
         *
         * ARDOUR_UI::starting connects app->ShouldLoad signal and then shows a SessionDialog