[libsoup] Fix websocket-related signal disconnection in soup-session.c



commit 8da87a6aad7cd221bdf787fcd1a9e8f12cd8d43f
Author: Dan Winship <danw gnome org>
Date:   Sun Sep 27 18:03:58 2015 -0400

    Fix websocket-related signal disconnection in soup-session.c
    
    g_signal_handlers_disconnect_by_func() doesn't work with signals
    connected with soup_message_add_status_code_handler().
    
    (Noticed while reviewing bug 637387.)

 libsoup/soup-session.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 3f84c69..5f03c63 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -4779,7 +4779,9 @@ websocket_connect_async_complete (SoupSession *session, SoupMessage *msg, gpoint
 {
        GTask *task = user_data;
 
-       g_signal_handlers_disconnect_by_func (msg, G_CALLBACK (websocket_connect_async_stop), task);
+       /* Disconnect websocket_connect_async_stop() handler. */
+       g_signal_handlers_disconnect_matched (msg, G_SIGNAL_MATCH_DATA,
+                                             0, 0, NULL, NULL, task);
 
        g_task_return_new_error (task,
                                 SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET,
@@ -4796,7 +4798,9 @@ websocket_connect_async_stop (SoupMessage *msg, gpointer user_data)
        SoupWebsocketConnection *client;
        GError *error = NULL;
 
-       g_signal_handlers_disconnect_by_func (msg, G_CALLBACK (websocket_connect_async_stop), task);
+       /* Disconnect websocket_connect_async_stop() handler. */
+       g_signal_handlers_disconnect_matched (msg, G_SIGNAL_MATCH_DATA,
+                                             0, 0, NULL, NULL, task);
 
        if (soup_websocket_client_verify_handshake (item->msg, &error)){
                stream = soup_session_steal_connection (item->session, item->msg);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]