<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[115777] trunk/dports/gnome/gnome-online-accounts</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/115777">115777</a></dd>
<dt>Author</dt> <dd>devans@macports.org</dd>
<dt>Date</dt> <dd>2014-01-10 18:00:46 -0800 (Fri, 10 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>gnome-online-accounts: update to version 3.8.5, apply current upstream patches.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdportsgnomegnomeonlineaccountsPortfile">trunk/dports/gnome/gnome-online-accounts/Portfile</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/dports/gnome/gnome-online-accounts/files/</li>
<li><a href="#trunkdportsgnomegnomeonlineaccountsfilespatchalarmdiff">trunk/dports/gnome/gnome-online-accounts/files/patch-alarm.diff</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportsgnomegnomeonlineaccountsPortfile"></a>
<div class="modfile"><h4>Modified: trunk/dports/gnome/gnome-online-accounts/Portfile (115776 => 115777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/gnome/gnome-online-accounts/Portfile        2014-01-11 01:16:22 UTC (rev 115776)
+++ trunk/dports/gnome/gnome-online-accounts/Portfile        2014-01-11 02:00:46 UTC (rev 115777)
</span><span class="lines">@@ -4,8 +4,7 @@
</span><span class="cx"> PortSystem      1.0
</span><span class="cx"> 
</span><span class="cx"> name            gnome-online-accounts
</span><del>-version         3.8.3
-revision        1
</del><ins>+version         3.8.5
</ins><span class="cx"> license         LGPL-2
</span><span class="cx"> set branch      [join [lrange [split ${version} .] 0 1] .]
</span><span class="cx"> description     Single sign-on framework for GNOME
</span><span class="lines">@@ -19,8 +18,8 @@
</span><span class="cx"> 
</span><span class="cx"> use_xz          yes
</span><span class="cx"> 
</span><del>-checksums       rmd160  6cd6b4d20eb1d1983baf3cad2b5edecb554a1b46 \
-                sha256  9e5e55c5097b8d7c32c0dfb7d94448795c627723b133e8edd0b846adde63a44b
</del><ins>+checksums       rmd160  21889d886fa262e536929ecb6905cfcd3f50a462 \
+                sha256  34d6fbc33bda4c7bba8aa52343ebe1eb8afe1033097c10a2d9979c0a99593e5d
</ins><span class="cx"> 
</span><span class="cx"> depends_build   port:pkgconfig \
</span><span class="cx">                 port:intltool \
</span><span class="lines">@@ -36,6 +35,8 @@
</span><span class="cx">                 port:gobject-introspection \
</span><span class="cx">                 port:gcr
</span><span class="cx"> 
</span><ins>+patchfiles      patch-alarm.diff
+
</ins><span class="cx"> configure.cflags-append -Wno-format-nonliteral
</span><span class="cx"> configure.args  --enable-introspection=yes
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkdportsgnomegnomeonlineaccountsfilespatchalarmdiff"></a>
<div class="addfile"><h4>Added: trunk/dports/gnome/gnome-online-accounts/files/patch-alarm.diff (0 => 115777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/gnome/gnome-online-accounts/files/patch-alarm.diff                                (rev 0)
+++ trunk/dports/gnome/gnome-online-accounts/files/patch-alarm.diff        2014-01-11 02:00:46 UTC (rev 115777)
</span><span class="lines">@@ -0,0 +1,539 @@
</span><ins>+From cd6ee762c3bfcd2d103f3ff50698032eb0fe6e91 Mon Sep 17 00:00:00 2001
+From: Debarshi Ray &lt;debarshir@gnome.org&gt;
+Date: Fri, 08 Nov 2013 17:33:49 +0000
+Subject: alarm: Do not clear the wrong objects when setting the time
+
+When the time is set using goa_alarm_set_time, we cancel the existing
+self-&gt;priv-&gt;cancellable and replace it with a new one. Then we take a
+reference to a new context and time. However, since when we cancelled
+the old cancellable, we triggered a chain of events which cause
+clear_scheduled_wakeups to be invoked from a idle callback. By the time
+it gets invoked, self-&gt;priv-&gt;cancellable, self-&gt;priv-&gt;context and
+self-&gt;priv-&gt;time point to the new objects that were set up in
+goa_alarm_set_time, which we don't want to clear.
+
+Actually, there is no point in clearing them in
+clear_scheduled_wakeups, because goa_alarm_set_time already clears up
+the older objects and the only other time we want to clear them is in
+dispose.
+
+Fixes: https://bugzilla.gnome.org/711696
+---
+diff --git a/src/goaidentity/goaalarm.c b/src/goaidentity/goaalarm.c
+index 5f50243..112cb00 100644
+--- src/goaidentity/goaalarm.c
++++ src/goaidentity/goaalarm.c
+@@ -151,15 +151,9 @@ clear_scheduled_wakeups (GoaAlarm *self)
+       break;
+     }

+-  g_clear_object (&amp;self-&gt;priv-&gt;cancellable);
+-
+-  g_clear_pointer (&amp;self-&gt;priv-&gt;context, (GDestroyNotify) g_main_context_unref);
+-
+   g_clear_pointer (&amp;self-&gt;priv-&gt;previous_wakeup_time,
+                    (GDestroyNotify) g_date_time_unref);

+-  g_clear_pointer (&amp;self-&gt;priv-&gt;time, (GDestroyNotify) g_date_time_unref);
+-
+   g_assert (self-&gt;priv-&gt;timeout.source == NULL);

+   self-&gt;priv-&gt;type = GOA_ALARM_TYPE_UNSCHEDULED;
+@@ -167,6 +161,18 @@ clear_scheduled_wakeups (GoaAlarm *self)
+ }

+ static void
++goa_alarm_dispose (GObject *object)
++{
++  GoaAlarm *self = GOA_ALARM (object);
++
++  g_clear_object (&amp;self-&gt;priv-&gt;cancellable);
++  g_clear_pointer (&amp;self-&gt;priv-&gt;context, (GDestroyNotify) g_main_context_unref);
++  g_clear_pointer (&amp;self-&gt;priv-&gt;time, (GDestroyNotify) g_date_time_unref);
++
++  G_OBJECT_CLASS (goa_alarm_parent_class)-&gt;dispose (object);
++}
++
++static void
+ goa_alarm_finalize (GObject *object)
+ {
+   GoaAlarm *self = GOA_ALARM (object);
+@@ -223,6 +229,7 @@ goa_alarm_class_init (GoaAlarmClass *klass)

+   object_class = G_OBJECT_CLASS (klass);

++  object_class-&gt;dispose = goa_alarm_dispose;
+   object_class-&gt;finalize = goa_alarm_finalize;
+   object_class-&gt;get_property = goa_alarm_get_property;
+   object_class-&gt;set_property = goa_alarm_set_property;
+@@ -637,6 +644,7 @@ goa_alarm_set_time (GoaAlarm *self, GDateTime *time, GCancellable *cancellable)

+   self-&gt;priv-&gt;time = time;

++  g_clear_pointer (&amp;self-&gt;priv-&gt;context, (GDestroyNotify) g_main_context_unref);
+   self-&gt;priv-&gt;context = g_main_context_ref (g_main_context_default ());

+   schedule_wakeups (self);
+--
+cgit v0.9.2
+From 5cbed5062f292a69fe1a514425ced1bd19589cbc Mon Sep 17 00:00:00 2001
+From: Debarshi Ray &lt;debarshir@gnome.org&gt;
+Date: Fri, 08 Nov 2013 17:36:46 +0000
+Subject: alarm: The global default main context is always the same
+
+Fixes: https://bugzilla.gnome.org/711696
+---
+diff --git a/src/goaidentity/goaalarm.c b/src/goaidentity/goaalarm.c
+index 112cb00..e51df73 100644
+--- src/goaidentity/goaalarm.c
++++ src/goaidentity/goaalarm.c
+@@ -644,8 +644,8 @@ goa_alarm_set_time (GoaAlarm *self, GDateTime *time, GCancellable *cancellable)

+   self-&gt;priv-&gt;time = time;

+-  g_clear_pointer (&amp;self-&gt;priv-&gt;context, (GDestroyNotify) g_main_context_unref);
+-  self-&gt;priv-&gt;context = g_main_context_ref (g_main_context_default ());
++  if (self-&gt;priv-&gt;context == NULL)
++    self-&gt;priv-&gt;context = g_main_context_ref (g_main_context_default ());

+   schedule_wakeups (self);

+--
+cgit v0.9.2
+From 8d0d36ecd67f4e020965efb74373db4644008bef Mon Sep 17 00:00:00 2001
+From: Debarshi Ray &lt;debarshir@gnome.org&gt;
+Date: Mon, 11 Nov 2013 10:51:42 +0000
+Subject: alarm: Use the same GSource pointer for TIMER and TIMEOUT alarms
+
+Simplifies the code so that it is easier to tag the &quot;cancelled&quot;
+handler with the correct GSource and GInputStream (if any) that are to
+be cleaned.
+
+Fixes: https://bugzilla.gnome.org/711696
+---
+diff --git a/src/goaidentity/goaalarm.c b/src/goaidentity/goaalarm.c
+index e51df73..eccfa09 100644
+--- src/goaidentity/goaalarm.c
++++ src/goaidentity/goaalarm.c
+@@ -1,6 +1,6 @@
+ /* -*- mode: C; c-file-style: &quot;gnu&quot;; indent-tabs-mode: nil; -*- */
+ /*
+- * Copyright (C) 2012 Red Hat, Inc.
++ * Copyright (C) 2012, 2013 Red Hat, Inc.
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+@@ -39,17 +39,6 @@

+ #include &quot;goalogging.h&quot;

+-typedef struct
+-{
+-  GSource *source;
+-  GInputStream *stream;
+-} Timer;
+-
+-typedef struct
+-{
+-  GSource *source;
+-} Timeout;
+-
+ #define MAX_TIMEOUT_INTERVAL (10 *1000)

+ typedef enum
+@@ -70,11 +59,8 @@ struct _GoaAlarmPrivate
+   GRecMutex lock;

+   GoaAlarmType type;
+-  union
+-  {
+-    Timer timer;
+-    Timeout timeout;
+-  };
++  GSource *scheduled_wakeup_source;
++  GInputStream *stream; /* NULL, unless using timerfd */
+ };

+ enum
+@@ -110,10 +96,10 @@ clear_scheduled_timer_wakeups (GoaAlarm *self)
+   GError *error;
+   gboolean is_closed;

+-  g_clear_pointer (&amp;self-&gt;priv-&gt;timer.source, (GDestroyNotify) g_source_destroy);
++  g_clear_pointer (&amp;self-&gt;priv-&gt;scheduled_wakeup_source, (GDestroyNotify) g_source_destroy);

+   error = NULL;
+-  is_closed = g_input_stream_close (self-&gt;priv-&gt;timer.stream, NULL, &amp;error);
++  is_closed = g_input_stream_close (self-&gt;priv-&gt;stream, NULL, &amp;error);

+   if (!is_closed)
+     {
+@@ -121,14 +107,14 @@ clear_scheduled_timer_wakeups (GoaAlarm *self)
+       g_error_free (error);
+     }

+-  g_clear_object (&amp;self-&gt;priv-&gt;timer.stream);
++  g_clear_object (&amp;self-&gt;priv-&gt;stream);
+ #endif
+ }

+ static void
+ clear_scheduled_timeout_wakeups (GoaAlarm *self)
+ {
+-  g_clear_pointer (&amp;self-&gt;priv-&gt;timeout.source, (GDestroyNotify) g_source_destroy);
++  g_clear_pointer (&amp;self-&gt;priv-&gt;scheduled_wakeup_source, (GDestroyNotify) g_source_destroy);
+ }

+ static void
+@@ -154,8 +140,6 @@ clear_scheduled_wakeups (GoaAlarm *self)
+   g_clear_pointer (&amp;self-&gt;priv-&gt;previous_wakeup_time,
+                    (GDestroyNotify) g_date_time_unref);

+-  g_assert (self-&gt;priv-&gt;timeout.source == NULL);
+-
+   self-&gt;priv-&gt;type = GOA_ALARM_TYPE_UNSCHEDULED;
+   g_rec_mutex_unlock (&amp;self-&gt;priv-&gt;lock);
+ }
+@@ -435,7 +419,7 @@ clear_timer_source (GTask *task)
+   GoaAlarm *self;

+   self = g_task_get_source_object (task);
+-  self-&gt;priv-&gt;timer.source = NULL;
++  self-&gt;priv-&gt;scheduled_wakeup_source = NULL;

+   g_object_unref (task);
+ }
+@@ -480,19 +464,19 @@ schedule_wakeups_with_timerfd (GoaAlarm *self)
+     }

+   self-&gt;priv-&gt;type = GOA_ALARM_TYPE_TIMER;
+-  self-&gt;priv-&gt;timer.stream = g_unix_input_stream_new (fd, TRUE);
++  self-&gt;priv-&gt;stream = g_unix_input_stream_new (fd, TRUE);

+   task = g_task_new (self, self-&gt;priv-&gt;cancellable, NULL, NULL);

+   source =
+     g_pollable_input_stream_create_source (G_POLLABLE_INPUT_STREAM
+-                                           (self-&gt;priv-&gt;timer.stream),
++                                           (self-&gt;priv-&gt;stream),
+                                            self-&gt;priv-&gt;cancellable);
+-  self-&gt;priv-&gt;timer.source = source;
+-  g_source_set_callback (self-&gt;priv-&gt;timer.source,
++  self-&gt;priv-&gt;scheduled_wakeup_source = source;
++  g_source_set_callback (self-&gt;priv-&gt;scheduled_wakeup_source,
+                          (GSourceFunc) on_timer_source_ready, task,
+                          (GDestroyNotify) clear_timer_source);
+-  g_source_attach (self-&gt;priv-&gt;timer.source, self-&gt;priv-&gt;context);
++  g_source_attach (self-&gt;priv-&gt;scheduled_wakeup_source, self-&gt;priv-&gt;context);
+   g_source_unref (source);

+   return TRUE;
+@@ -528,7 +512,7 @@ out:
+ static void
+ clear_timeout_source_pointer (GoaAlarm *self)
+ {
+-  self-&gt;priv-&gt;timeout.source = NULL;
++  self-&gt;priv-&gt;scheduled_wakeup_source = NULL;
+ }

+ static void
+@@ -556,13 +540,13 @@ schedule_wakeups_with_timeout_source (GoaAlarm *self)

+   source = g_timeout_source_new (interval);

+-  self-&gt;priv-&gt;timeout.source = source;
+-  g_source_set_callback (self-&gt;priv-&gt;timeout.source,
++  self-&gt;priv-&gt;scheduled_wakeup_source = source;
++  g_source_set_callback (self-&gt;priv-&gt;scheduled_wakeup_source,
+                          (GSourceFunc)
+                          on_timeout_source_ready,
+                          self, (GDestroyNotify) clear_timeout_source_pointer);

+-  g_source_attach (self-&gt;priv-&gt;timeout.source, self-&gt;priv-&gt;context);
++  g_source_attach (self-&gt;priv-&gt;scheduled_wakeup_source, self-&gt;priv-&gt;context);
+   g_source_unref (source);
+ }

+--
+cgit v0.9.2
+From b7deea49691d7a9c1f4b2c7acdf9b77f2d69fda4 Mon Sep 17 00:00:00 2001
+From: Debarshi Ray &lt;debarshir@gnome.org&gt;
+Date: Mon, 11 Nov 2013 12:11:28 +0000
+Subject: alarm: Tag the &quot;cancelled&quot; handler with the correct source and stream
+
+When a time is set using goa_alarm_set_time, we try to clear the older
+source and stream by cancelling self-&gt;priv-&gt;cancellable. However,
+before we have had a chance to actually clear them in an idle callback,
+a new source and stream corresponding to the new time is set. This
+causes the older source and stream to be leaked, and instead the newly
+created objects are cleared.
+
+This is wrong. To set things right, we tag the cancelled handler with
+the older source and stream before they are overwritten.
+
+Fixes: https://bugzilla.gnome.org/711696
+---
+diff --git a/src/goaidentity/goaalarm.c b/src/goaidentity/goaalarm.c
+index eccfa09..442f275 100644
+--- src/goaidentity/goaalarm.c
++++ src/goaidentity/goaalarm.c
+@@ -90,16 +90,16 @@ clear_scheduled_immediate_wakeup (GoaAlarm *self)
+ }

+ static void
+-clear_scheduled_timer_wakeups (GoaAlarm *self)
++clear_scheduled_timer_wakeups (GoaAlarm *self, GSource *source, GInputStream *stream)
+ {
+ #ifdef HAVE_TIMERFD
+   GError *error;
+   gboolean is_closed;

+-  g_clear_pointer (&amp;self-&gt;priv-&gt;scheduled_wakeup_source, (GDestroyNotify) g_source_destroy);
++  g_source_destroy (source);

+   error = NULL;
+-  is_closed = g_input_stream_close (self-&gt;priv-&gt;stream, NULL, &amp;error);
++  is_closed = g_input_stream_close (stream, NULL, &amp;error);

+   if (!is_closed)
+     {
+@@ -107,18 +107,18 @@ clear_scheduled_timer_wakeups (GoaAlarm *self)
+       g_error_free (error);
+     }

+-  g_clear_object (&amp;self-&gt;priv-&gt;stream);
++  g_object_unref (stream);
+ #endif
+ }

+ static void
+-clear_scheduled_timeout_wakeups (GoaAlarm *self)
++clear_scheduled_timeout_wakeups (GoaAlarm *self, GSource *source)
+ {
+-  g_clear_pointer (&amp;self-&gt;priv-&gt;scheduled_wakeup_source, (GDestroyNotify) g_source_destroy);
++  g_source_destroy (source);
+ }

+ static void
+-clear_scheduled_wakeups (GoaAlarm *self)
++clear_scheduled_wakeups (GoaAlarm *self, GSource *source, GInputStream *stream)
+ {
+   g_rec_mutex_lock (&amp;self-&gt;priv-&gt;lock);
+   clear_scheduled_immediate_wakeup (self);
+@@ -126,11 +126,11 @@ clear_scheduled_wakeups (GoaAlarm *self)
+   switch (self-&gt;priv-&gt;type)
+     {
+     case GOA_ALARM_TYPE_TIMER:
+-      clear_scheduled_timer_wakeups (self);
++      clear_scheduled_timer_wakeups (self, source, stream);
+       break;

+     case GOA_ALARM_TYPE_TIMEOUT:
+-      clear_scheduled_timeout_wakeups (self);
++      clear_scheduled_timeout_wakeups (self, source);
+       break;

+     default:
+@@ -161,7 +161,7 @@ goa_alarm_finalize (GObject *object)
+ {
+   GoaAlarm *self = GOA_ALARM (object);

+-  clear_scheduled_wakeups (self);
++  clear_scheduled_wakeups (self, self-&gt;priv-&gt;scheduled_wakeup_source, self-&gt;priv-&gt;stream);

+   G_OBJECT_CLASS (goa_alarm_parent_class)-&gt;finalize (object);
+ }
+@@ -250,9 +250,18 @@ goa_alarm_init (GoaAlarm *self)
+ static gboolean
+ async_alarm_cancel_idle_cb (gpointer user_data)
+ {
+-  GoaAlarm *self = user_data;
++  GoaAlarm *self;
++  GInputStream *stream;
++  GSource *source;
++  GTask *task = G_TASK (user_data);
++  gpointer task_data;

+-  clear_scheduled_wakeups (self);
++  self = g_task_get_source_object (task);
++  source = (GSource *) g_object_get_data (G_OBJECT (task), &quot;alarm-scheduled-wakeup-source&quot;);
++  task_data = g_object_get_data (G_OBJECT (task), &quot;alarm-stream&quot;);
++  stream = (task_data == NULL) ? NULL : G_INPUT_STREAM (task_data);
++
++  clear_scheduled_wakeups (self, source, stream);
+   return G_SOURCE_REMOVE;
+ }

+@@ -261,13 +270,25 @@ on_cancelled (GCancellable *cancellable, gpointer user_data)
+ {
+   GoaAlarm *self = GOA_ALARM (user_data);
+   GSource *idle_source;
++  GTask *task;

++  task = g_task_new (self, NULL, NULL, NULL);
++
++  g_object_set_data_full (G_OBJECT (task),
++                          &quot;alarm-scheduled-wakeup-source&quot;,
++                          g_source_ref (self-&gt;priv-&gt;scheduled_wakeup_source),
++                          (GDestroyNotify) g_source_unref);
++
++  if (self-&gt;priv-&gt;stream != NULL)
++    g_object_set_data_full (G_OBJECT (task), &quot;alarm-stream&quot;, g_object_ref (self-&gt;priv-&gt;stream), g_object_unref);

+   idle_source = g_idle_source_new ();
+   g_source_set_priority (idle_source, G_PRIORITY_HIGH_IDLE);
+-  g_source_set_callback (idle_source, async_alarm_cancel_idle_cb, g_object_ref (self), g_object_unref);
++  g_source_set_callback (idle_source, async_alarm_cancel_idle_cb, g_object_ref (task), g_object_unref);
+   g_source_attach (idle_source, self-&gt;priv-&gt;context);
+   g_source_unref (idle_source);
++
++  g_object_unref (task);
+ }

+ static void
+@@ -412,17 +433,6 @@ out:
+   g_rec_mutex_unlock (&amp;self-&gt;priv-&gt;lock);
+   return run_again;
+ }
+-
+-static void
+-clear_timer_source (GTask *task)
+-{
+-  GoaAlarm *self;
+-
+-  self = g_task_get_source_object (task);
+-  self-&gt;priv-&gt;scheduled_wakeup_source = NULL;
+-
+-  g_object_unref (task);
+-}
+ #endif

+ static gboolean
+@@ -475,7 +485,7 @@ schedule_wakeups_with_timerfd (GoaAlarm *self)
+   self-&gt;priv-&gt;scheduled_wakeup_source = source;
+   g_source_set_callback (self-&gt;priv-&gt;scheduled_wakeup_source,
+                          (GSourceFunc) on_timer_source_ready, task,
+-                         (GDestroyNotify) clear_timer_source);
++                         (GDestroyNotify) g_object_unref);
+   g_source_attach (self-&gt;priv-&gt;scheduled_wakeup_source, self-&gt;priv-&gt;context);
+   g_source_unref (source);

+--
+cgit v0.9.2
+From 72e6d277de953b24e488a7b75464883a4abb5ca1 Mon Sep 17 00:00:00 2001
+From: Debarshi Ray &lt;debarshir@gnome.org&gt;
+Date: Mon, 11 Nov 2013 13:49:06 +0000
+Subject: alarm: Remove redundant preprocessor conditional
+
+Reading the rest of the code, it appears to me that the preprocessor
+conditionals were meant to surpress compiler warnings and errors
+caused by the lack of timerfd support. For the rest of the logic,
+GoaAlarmType is used to separate the different kinds of timers.
+
+Fixes: https://bugzilla.gnome.org/711696
+---
+diff --git a/src/goaidentity/goaalarm.c b/src/goaidentity/goaalarm.c
+index 442f275..9e0ab64 100644
+--- src/goaidentity/goaalarm.c
++++ src/goaidentity/goaalarm.c
+@@ -92,7 +92,6 @@ clear_scheduled_immediate_wakeup (GoaAlarm *self)
+ static void
+ clear_scheduled_timer_wakeups (GoaAlarm *self, GSource *source, GInputStream *stream)
+ {
+-#ifdef HAVE_TIMERFD
+   GError *error;
+   gboolean is_closed;

+@@ -108,7 +107,6 @@ clear_scheduled_timer_wakeups (GoaAlarm *self, GSource *source, GInputStream *st
+     }

+   g_object_unref (stream);
+-#endif
+ }

+ static void
+--
+cgit v0.9.2
+From c4f25c45758875a430af39663b3f8b81091320f1 Mon Sep 17 00:00:00 2001
+From: Debarshi Ray &lt;debarshir@gnome.org&gt;
+Date: Tue, 12 Nov 2013 10:00:05 +0000
+Subject: alarm: Consolidate clear_scheduled_time*_wakeups into one function
+
+Since we are using the same GSource pointer for TIMER and TIMEOUT
+alarms, there is no reason to continue having separate functions.
+
+Fixes: https://bugzilla.gnome.org/711696
+---
+diff --git a/src/goaidentity/goaalarm.c b/src/goaidentity/goaalarm.c
+index 9e0ab64..ed805d7 100644
+--- src/goaidentity/goaalarm.c
++++ src/goaidentity/goaalarm.c
+@@ -90,49 +90,31 @@ clear_scheduled_immediate_wakeup (GoaAlarm *self)
+ }

+ static void
+-clear_scheduled_timer_wakeups (GoaAlarm *self, GSource *source, GInputStream *stream)
+-{
+-  GError *error;
+-  gboolean is_closed;
+-
+-  g_source_destroy (source);
+-
+-  error = NULL;
+-  is_closed = g_input_stream_close (stream, NULL, &amp;error);
+-
+-  if (!is_closed)
+-    {
+-      goa_warning (&quot;GoaAlarm: could not close timer stream: %s&quot;, error-&gt;message);
+-      g_error_free (error);
+-    }
+-
+-  g_object_unref (stream);
+-}
+-
+-static void
+-clear_scheduled_timeout_wakeups (GoaAlarm *self, GSource *source)
+-{
+-  g_source_destroy (source);
+-}
+-
+-static void
+ clear_scheduled_wakeups (GoaAlarm *self, GSource *source, GInputStream *stream)
+ {
+   g_rec_mutex_lock (&amp;self-&gt;priv-&gt;lock);
+   clear_scheduled_immediate_wakeup (self);

+-  switch (self-&gt;priv-&gt;type)
++  if (self-&gt;priv-&gt;type != GOA_ALARM_TYPE_UNSCHEDULED)
+     {
+-    case GOA_ALARM_TYPE_TIMER:
+-      clear_scheduled_timer_wakeups (self, source, stream);
+-      break;
++      g_source_destroy (source);

+-    case GOA_ALARM_TYPE_TIMEOUT:
+-      clear_scheduled_timeout_wakeups (self, source);
+-      break;
++      if (stream != NULL)
++        {
++          GError *error;
++          gboolean is_closed;

+-    default:
+-      break;
++          error = NULL;
++          is_closed = g_input_stream_close (stream, NULL, &amp;error);
++
++          if (!is_closed)
++            {
++              goa_warning (&quot;GoaAlarm: could not close timer stream: %s&quot;, error-&gt;message);
++              g_error_free (error);
++            }
++
++          g_object_unref (stream);
++        }
+     }

+   g_clear_pointer (&amp;self-&gt;priv-&gt;previous_wakeup_time,
+--
+cgit v0.9.2
</ins></span></pre>
</div>
</div>

</body>
</html>