From b22682d2a292796e96029b8d21e0a3977c381a59 Mon Sep 17 00:00:00 2001 From: Mark Pariente Date: Tue, 2 Dec 2014 14:14:52 -0800 Subject: [PATCH] Geary window does not open due to race condition: Bug #737811 Although prior fix for bug #737811 solved problem for some users, apparently Geary still had an issue when upgrading a database with new GLib Mutex implementation, which uses Linux's futexes whenever available. This solution gives the notifying thread a chance to signal the waiter that its work is completed. --- THANKS | 1 + src/engine/util/util-synchronization.vala | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/THANKS b/THANKS index ae0dc02c..adf85f05 100644 --- a/THANKS +++ b/THANKS @@ -34,6 +34,7 @@ Georges Basile Stavracas Neto Philipp Nordhus Andreas Obergrusberger Martin Olsson +Mark Pariente Robert Park Mario Sanchez Prada Tiago Quelhas diff --git a/src/engine/util/util-synchronization.vala b/src/engine/util/util-synchronization.vala index 9416d122..36e6ba75 100644 --- a/src/engine/util/util-synchronization.vala +++ b/src/engine/util/util-synchronization.vala @@ -64,10 +64,14 @@ public class SpinWaiter : BaseObject { int64 end_time = get_monotonic_time() + (actual_poll_msec * TimeSpan.MILLISECOND); if (!cond.wait_until(mutex, end_time)) { // timeout passed, allow the callback to run + mutex.unlock(); if (!cb()) { // PollService returned false, abort + mutex.lock(); + break; } + mutex.lock(); } }