From 97d3b8f092ab27874222433ed0114a067beb9b83 Mon Sep 17 00:00:00 2001 From: gc Date: Sun, 29 Jan 2006 16:47:01 +0000 Subject: [PATCH] hopefully fixing the rest of potential aborts, thx to a suggestion from fif --- bin/booh | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/bin/booh b/bin/booh index 4a8b8c8..0da74c0 100755 --- a/bin/booh +++ b/bin/booh @@ -3986,12 +3986,16 @@ def gtk_thread_protect(&proc) end def gtk_thread_flush - $protect_gtk_pending_calls.try_lock - for closure in $gtk_pending_calls - closure.call + #- try to lock. we cannot synchronize blindly because this might be called from + #- within the timeout flushing procs. if this is the case, not doing anything + #- should be ok since the timeout is already flushing them all. + if $protect_gtk_pending_calls.try_lock + for closure in $gtk_pending_calls + closure.call + end + $gtk_pending_calls = [] + $protect_gtk_pending_calls.unlock end - $gtk_pending_calls = [] - $protect_gtk_pending_calls.unlock end def ask_password_protect @@ -4228,15 +4232,12 @@ def create_main_window $protect_gtk_pending_calls = Mutex.new $gtk_pending_calls = [] Gtk.timeout_add(100) { - empty = nil - begin - $protect_gtk_pending_calls.synchronize { - if ! $gtk_pending_calls.empty? - $gtk_pending_calls.shift.call - end - empty = $gtk_pending_calls.empty? - } - end while ! empty + $protect_gtk_pending_calls.synchronize { + for closure in $gtk_pending_calls + closure.call + end + $gtk_pending_calls = [] + } true } -- 2.30.4