]> matita.cs.unibo.it Git - helm.git/commitdiff
Avoid race conditions (deadlocks)
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Fri, 30 Dec 2022 20:31:23 +0000 (21:31 +0100)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Fri, 30 Dec 2022 20:31:23 +0000 (21:31 +0100)
matita/matita/matitaGui.ml
matita/matita/matitaScript.ml

index 7e2b0401bbc41659bc60e8a9f0e1c4735efa6450..2a1381e3ddd4d8c96625fc95a1fc509ecb5f1ef6 100644 (file)
@@ -558,9 +558,7 @@ class gui () =
        let source_view = (s ())#source_view in
         main#buttonsToolbar#misc#set_sensitive true;
         main#scriptMenu#misc#set_sensitive true;
-        source_view#set_editable true;
-        (*The next line seems sufficient to avoid some unknown race condition *)
-        GtkThread.sync (fun () -> ()) ()
+        source_view#set_editable true
       in
       let worker_thread = ref None in
       let notify_exn (source_view : GSourceView3.source_view) exn =
index 2401221344c43de37f287d89afbd0f8156128065..711ac975a8482b0b10993aaf87b141150148cdb3 100644 (file)
@@ -773,7 +773,8 @@ object (self)
       | n (* when n < 0 *) -> current_mark_pos#backward_chars (abs n)
     in
     buffer#move_mark mark ~where:new_mark_pos;
-    buffer#apply_tag locked_tag ~start:buffer#start_iter ~stop:new_mark_pos;
+    (* CSC: the next line is required to avoid race conditions (deadlocks) *)
+    GtkThread.sync(fun () -> buffer#apply_tag locked_tag ~start:buffer#start_iter ~stop:new_mark_pos) ();
     buffer#move_mark `INSERT old_insert;
     let mark_position = buffer#get_iter_at_mark mark in
     if source_view#move_mark_onscreen mark then