# # patch "glib/giochannel.mli" # from [6e1bff38096a9f626f8e8923b4fc6d603ff105e3] # to [0fd137687560f6951e5377ac213371df7135e53f] # # patch "query.ml" # from [85e05714c302fcd4df68c95f994532a5b9c8dfb6] # to [ace2d1856ca61cfa70f708386fbeb82415ce7b4d] # # patch "subprocess.ml" # from [e047bb5bcd5ea674256397d3f8ea0b5c2ce3f919] # to [f01fde6d68f1d9bce01092b4c57bae73ce1ccb83] # ======================================================================== --- glib/giochannel.mli 6e1bff38096a9f626f8e8923b4fc6d603ff105e3 +++ glib/giochannel.mli 0fd137687560f6951e5377ac213371df7135e53f @@ -46,6 +46,7 @@ ?prio:int -> t -> condition list -> (condition list -> bool) -> source_id = "_ml_g_io_add_watch" external remove_watch : source_id -> unit = "_ml_g_source_remove" +(** @raise Not_found .*) external get_buffer_size : t -> int = "ml_g_io_channel_get_buffer_size" external set_buffer_size : t -> int -> unit ======================================================================== --- query.ml 85e05714c302fcd4df68c95f994532a5b9c8dfb6 +++ query.ml ace2d1856ca61cfa70f708386fbeb82415ce7b4d @@ -201,7 +201,7 @@ m, v, set_label let update_results m r = - if r <> [] then clear_model m ; + clear_model m ; m.model#set_sort_column_id (-2) `DESCENDING ; List.iter (fun (id, date, author) -> ======================================================================== --- subprocess.ml e047bb5bcd5ea674256397d3f8ea0b5c2ce3f919 +++ subprocess.ml f01fde6d68f1d9bce01092b4c57bae73ce1ccb83 @@ -38,6 +38,7 @@ then cb () type watch = { + mutable finished : bool ; name : string ; chan : Giochannel.t ; exn_cb : exn -> unit ; @@ -45,6 +46,7 @@ } let stop_watch w = + w.finished <- true ; debug "%s cb: closing pipe" w.name ; try Giochannel.shutdown w.chan true with Giochannel.Error (_, msg) | Glib.Convert.Error (_, msg) -> @@ -167,14 +169,15 @@ if has_input then begin let ic = setup_channel ~nonblock:true encoding child_info.Gspawn.standard_input in - let in_watch = { name = "stdin" ; chan = ic ; exn_cb = exn_cb ; done_cb = all_done } in + let in_watch = { name = "stdin" ; finished = false ; chan = ic ; + exn_cb = exn_cb ; done_cb = all_done } in let in_id = in_channel_watch in_watch (some input_opt) in add_watch in_watch in_id end ; begin let oc = setup_channel ~nonblock:false encoding child_info.Gspawn.standard_output in - let out_watch = { name = "stdout" ; chan = oc ; + let out_watch = { name = "stdout" ; finished = false ; chan = oc ; exn_cb = exn_cb ; done_cb = all_done } in let out_id = out_channel_watch out_watch out_buffer in add_watch out_watch out_id @@ -182,7 +185,7 @@ begin let ec = setup_channel ~nonblock:false encoding child_info.Gspawn.standard_error in - let err_watch = { name = "stderr" ; chan = ec ; + let err_watch = { name = "stderr" ; finished = false ; chan = ec ; exn_cb = exn_cb ; done_cb = all_done } in let err_id = out_channel_watch err_watch err_buffer in add_watch err_watch err_id @@ -192,7 +195,10 @@ let pid_id = pid_watch pid (fun s -> state.status <- s ; - reap_callback () ; + begin + try reap_callback () + with _ -> () + end ; Gspawn.close_pid pid ; all_done ()) in @@ -217,7 +223,9 @@ sub_data.aborted <- true ; List.iter (fun (w, id) -> - Giochannel.remove_watch id ; - stop_watch w) + if not w.finished then begin + Giochannel.remove_watch id ; + stop_watch w + end) sub_data.watches end