diff options
author | Alban Crequy <alban.crequy@collabora.co.uk> | 2013-06-17 15:07:15 +0100 |
---|---|---|
committer | Alban Crequy <alban.crequy@collabora.co.uk> | 2013-06-17 16:55:35 +0100 |
commit | 2b363686aa1cbfa2d778a16b813472f1bf309cbf (patch) | |
tree | cf3c39dca5c971d426651b53875fc552cbfcaf63 /rest/rest-proxy-call.c | |
parent | 3a60542a454eeb98ae025bad960fefefc94ca416 (diff) | |
download | librest-2b363686aa1cbfa2d778a16b813472f1bf309cbf.tar.gz |
call: disconnect GCancellable 'cancel' signal
Without this fix, the call object could be freed before any
cancellation. But the 'cancel' callback should not be executed on a
freed object.
https://bugzilla.gnome.org/show_bug.cgi?id=702483
Diffstat (limited to 'rest/rest-proxy-call.c')
-rw-r--r-- | rest/rest-proxy-call.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c index 3e3474b..97ed185 100644 --- a/rest/rest-proxy-call.c +++ b/rest/rest-proxy-call.c @@ -110,6 +110,12 @@ rest_proxy_call_dispose (GObject *object) { RestProxyCallPrivate *priv = GET_PRIVATE (object); + if (priv->cancellable) + { + g_signal_handler_disconnect (priv->cancellable, priv->cancel_sig); + g_clear_object (&priv->cancellable); + } + if (priv->params) { rest_params_free (priv->params); @@ -921,8 +927,6 @@ _call_message_call_completed_cb (SoupSession *session, call = REST_PROXY_CALL ( g_async_result_get_source_object (G_ASYNC_RESULT (result))); - // FIXME: disconnect cancellable ? - finish_call (call, message, &error); if (error != NULL) @@ -973,8 +977,11 @@ rest_proxy_call_invoke_async (RestProxyCall *call, user_data, rest_proxy_call_invoke_async); if (cancellable != NULL) - g_signal_connect (cancellable, "cancelled", - G_CALLBACK (_call_message_call_cancelled_cb), call); + { + priv->cancel_sig = g_signal_connect (cancellable, "cancelled", + G_CALLBACK (_call_message_call_cancelled_cb), call); + priv->cancellable = g_object_ref (cancellable); + } _rest_proxy_queue_message (priv->proxy, message, @@ -1259,6 +1266,12 @@ rest_proxy_call_cancel (RestProxyCall *call) priv = GET_PRIVATE (call); closure = priv->cur_call_closure; + if (priv->cancellable) + { + g_signal_handler_disconnect (priv->cancellable, priv->cancel_sig); + g_clear_object (&priv->cancellable); + } + if (closure) { /* This will cause the _call_message_completed_cb to be fired which will |