fix for #1503, crash on new session in write-protected dir
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 26 Feb 2007 04:37:32 +0000 (04:37 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 26 Feb 2007 04:37:32 +0000 (04:37 +0000)
git-svn-id: svn://localhost/ardour2/trunk@1510 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui.cc
libs/ardour/session_butler.cc
libs/ardour/session_midi.cc
libs/ardour/session_state.cc

index 8823ad8ad0562788f2a65ac90b4e2a8c02583b36..c6db2716c571a49a9da4c53be056fc02fb44e315 100644 (file)
@@ -1866,15 +1866,20 @@ ARDOUR_UI::new_session (std::string predetermined_path)
                                        uint32_t nphysin = (uint32_t) new_session_dialog->input_limit_count();
                                        uint32_t nphysout = (uint32_t) new_session_dialog->output_limit_count();
                                                        
                                        uint32_t nphysin = (uint32_t) new_session_dialog->input_limit_count();
                                        uint32_t nphysout = (uint32_t) new_session_dialog->output_limit_count();
                                                        
-                                       build_session (session_path,
-                                                      session_name,
-                                                      cchns,
-                                                      mchns,
-                                                      iconnect,
-                                                      oconnect,
-                                                      nphysin,
-                                                      nphysout, 
-                                                      engine->frame_rate() * 60 * 5);
+                                       if (build_session (session_path,
+                                                          session_name,
+                                                          cchns,
+                                                          mchns,
+                                                          iconnect,
+                                                          oconnect,
+                                                          nphysin,
+                                                          nphysout, 
+                                                          engine->frame_rate() * 60 * 5)) {
+
+                                               response = Gtk::RESPONSE_NONE;
+                                               new_session_dialog->reset ();
+                                               continue;
+                                       }
                                }
                        }
                }
                                }
                        }
                }
@@ -1973,7 +1978,8 @@ ARDOUR_UI::build_session (const string & path, const string & snap_name,
 
        catch (...) {
 
 
        catch (...) {
 
-               error << string_compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name) << endmsg;
+               MessageDialog msg (string_compose(_("Could not create session in \"%1\""), path));
+               msg.run ();
                return -1;
        }
 
                return -1;
        }
 
index 6c3fdea7e6846e903a95e21240834aa2cfa045cb..16c8d9cffa7b361bd19ec1cea2dfad789238765e 100644 (file)
@@ -103,10 +103,12 @@ Session::start_butler_thread ()
 void
 Session::terminate_butler_thread ()
 {
 void
 Session::terminate_butler_thread ()
 {
-       void* status;
-       char c = ButlerRequest::Quit;
-       ::write (butler_request_pipe[1], &c, 1);
-       pthread_join (butler_thread, &status);
+       if (butler_thread) {
+               void* status;
+               char c = ButlerRequest::Quit;
+               ::write (butler_request_pipe[1], &c, 1);
+               pthread_join (butler_thread, &status);
+       }
 }
 
 void
 }
 
 void
index ad6ea5654a9f2c0f85f5f0ade6aaa661055c8c77..4c899d59094edede496e647fb3f2598f41e34c09 100644 (file)
@@ -1114,15 +1114,17 @@ Session::start_midi_thread ()
 void
 Session::terminate_midi_thread ()
 {
 void
 Session::terminate_midi_thread ()
 {
-       MIDIRequest* request = new MIDIRequest;
-       void* status;
-
-       request->type = MIDIRequest::Quit;
-
-       midi_requests.write (&request, 1);
-       poke_midi_thread ();
-
-       pthread_join (midi_thread, &status);
+       if (midi_thread) {
+               MIDIRequest* request = new MIDIRequest;
+               void* status;
+               
+               request->type = MIDIRequest::Quit;
+               
+               midi_requests.write (&request, 1);
+               poke_midi_thread ();
+               
+               pthread_join (midi_thread, &status);
+       }
 }
 
 void
 }
 
 void
index ea35e853ecc1d6eed34837de42ad2b1346d9ed03..69c47d2f08cbab40b204a31cd1ac15a35db142fb 100644 (file)
@@ -183,6 +183,8 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        current_trans = 0;
        first_file_data_format_reset = true;
        first_file_header_format_reset = true;
        current_trans = 0;
        first_file_data_format_reset = true;
        first_file_header_format_reset = true;
+       butler_thread = (pthread_t) 0;
+       midi_thread = (pthread_t) 0;
 
        AudioDiskstream::allocate_working_buffers();
        
 
        AudioDiskstream::allocate_working_buffers();