[gnome-online-accounts/gnome-3-10] goaalarm: add locks when setting up timers
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/gnome-3-10] goaalarm: add locks when setting up timers
- Date: Tue, 15 Oct 2013 11:49:39 +0000 (UTC)
commit 6d2a15524bb4c13590b2c609ea21ab8cbfc454bb
Author: Ray Strode <rstrode redhat com>
Date: Fri Oct 11 11:19:42 2013 -0400
goaalarm: add locks when setting up timers
An alarm could be getting set in one thread while getting
cleared in another. We need to protect against that.
https://bugzilla.gnome.org/show_bug.cgi?id=709953
src/goaidentity/goaalarm.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/goaidentity/goaalarm.c b/src/goaidentity/goaalarm.c
index f098524..920e43f 100644
--- a/src/goaidentity/goaalarm.c
+++ b/src/goaidentity/goaalarm.c
@@ -609,6 +609,7 @@ goa_alarm_set_time (GoaAlarm *self, GDateTime *time, GCancellable *cancellable)
if (g_cancellable_is_cancelled (cancellable))
return;
+ g_rec_mutex_lock (&self->priv->lock);
if (self->priv->cancellable != NULL && self->priv->cancellable != cancellable)
g_cancellable_cancel (self->priv->cancellable);
@@ -638,12 +639,12 @@ goa_alarm_set_time (GoaAlarm *self, GDateTime *time, GCancellable *cancellable)
self->priv->context = g_main_context_ref (g_main_context_default ());
- g_object_notify (G_OBJECT (self), "time");
-
schedule_wakeups (self);
/* Wake up right away, in case it's already expired leaving the gate */
schedule_immediate_wakeup (self);
+ g_rec_mutex_unlock (&self->priv->lock);
+ g_object_notify (G_OBJECT (self), "time");
}
GDateTime *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]