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
This commit is contained in:
Dan Winship 2013-11-02 09:33:26 -04:00
parent b4aee2a759
commit fff14a5b7c

View File

@ -736,11 +736,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;