[glib/glib-2-38] gcancellable: don't use g_cancellable_connect() in GCancellableSource
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-38] gcancellable: don't use g_cancellable_connect() in GCancellableSource
- Date: Mon, 11 Nov 2013 14:49:48 +0000 (UTC)
commit bbf7b493918dde279e1c2db53bd5f2375fafa43e
Author: Dan Winship <danw gnome org>
Date: Sat Nov 2 09:33:26 2013 -0400
gcancellable: don't use g_cancellable_connect() in GCancellableSource
g_cancellable_connect() is documented as calling its callback only
once, but GCancellableSource should trigger every time the cancellable
is cancelled.
https://bugzilla.gnome.org/show_bug.cgi?id=710691
https://bugzilla.gnome.org/show_bug.cgi?id=711286
gio/gcancellable.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gio/gcancellable.c b/gio/gcancellable.c
index fc56b87..b1a072b 100644
--- a/gio/gcancellable.c
+++ b/gio/gcancellable.c
@@ -728,11 +728,16 @@ g_cancellable_source_new (GCancellable *cancellable)
if (cancellable)
{
cancellable_source->cancellable = g_object_ref (cancellable);
+
+ /* We intentionally don't use g_cancellable_connect() here,
+ * because we don't want the "at most once" behavior.
+ */
cancellable_source->cancelled_handler =
- g_cancellable_connect (cancellable,
- G_CALLBACK (cancellable_source_cancelled),
- source,
- NULL);
+ g_signal_connect (cancellable, "cancelled",
+ G_CALLBACK (cancellable_source_cancelled),
+ source);
+ if (g_cancellable_is_cancelled (cancellable))
+ g_source_set_ready_time (source, 0);
}
return source;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]