[gnome-online-accounts/gnome-3-8] identity: Fix occasional warning spew
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/gnome-3-8] identity: Fix occasional warning spew
- Date: Tue, 1 Oct 2013 15:54:37 +0000 (UTC)
commit 68b5d360f22ca4c08f8eef578cc20318b6d157b3
Author: Ray Strode <rstrode redhat com>
Date: Mon Sep 30 13:58:54 2013 -0400
identity: Fix occasional warning spew
It's possible to unschedule a timer when the timer is already dispatched,
but not yet holding the lock. If this happens, a precondition check
for the timer type may fail, leading to warning on the console.
This commit moves that precondition check to within the lock, and
also adds an explicit check to see if the timer has been unscheduled,
shortly after dispatch.
https://bugzilla.gnome.org/show_bug.cgi?id=709103
src/goaidentity/goaalarm.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/goaidentity/goaalarm.c b/src/goaidentity/goaalarm.c
index afcb9d6..a3eb550 100644
--- a/src/goaidentity/goaalarm.c
+++ b/src/goaidentity/goaalarm.c
@@ -372,9 +372,24 @@ on_timer_source_ready (GObject *stream, GTask *task)
cancellable = g_task_get_cancellable (task);
g_return_val_if_fail (GOA_IS_ALARM (self), FALSE);
- g_return_val_if_fail (self->priv->type == GOA_ALARM_TYPE_TIMER, FALSE);
g_rec_mutex_lock (&self->priv->lock);
+
+ if (self->priv->type == GOA_ALARM_TYPE_UNSCHEDULED)
+ {
+ goa_debug ("GoaAlarm: timer source was unscheduled after "
+ "callback was invoked, but before callback got "
+ "the lock.");
+ goto out;
+ }
+ else if (self->priv->type != GOA_ALARM_TYPE_TIMER)
+ {
+ goa_warning ("GoaAlarm: timer source ready callback called "
+ "when timer source isn't supposed to be used. "
+ "Current timer type is %u", self->priv->type);
+ goto out;
+ }
+
if (g_cancellable_is_cancelled (cancellable))
goto out;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]