[libsoup/return-if-client_io-is-null: 1/2] Disconnect signal handlers in 'soup_client_message_io_http1_finished' and 'soup_client_message_io_ht
- From: Diego Pino <dpino src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/return-if-client_io-is-null: 1/2] Disconnect signal handlers in 'soup_client_message_io_http1_finished' and 'soup_client_message_io_ht
- Date: Thu, 13 May 2021 06:56:08 +0000 (UTC)
commit f26b7cbcc7366884331946b521d415e80f310577
Author: Diego Pino Garcia <dpino igalia com>
Date: Thu May 13 14:32:55 2021 +0800
Disconnect signal handlers in 'soup_client_message_io_http1_finished' and
'soup_client_message_io_http1_stolen'
Also refactored common code.
libsoup/soup-client-message-io-http1.c | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/libsoup/soup-client-message-io-http1.c b/libsoup/soup-client-message-io-http1.c
index 4ade4e1b..67f3da3c 100644
--- a/libsoup/soup-client-message-io-http1.c
+++ b/libsoup/soup-client-message-io-http1.c
@@ -67,6 +67,21 @@ soup_client_message_io_http1_get_priority (SoupClientMessageIOHTTP1 *io)
return g_task_get_priority (io->item->task);
}
+static void
+soup_client_message_io_complete (SoupMessage *msg,
+ SoupMessageIOCompletion completion,
+ SoupMessageIOCompletionFn completion_cb,
+ gpointer completion_data)
+{
+ SoupConnection* conn = soup_message_get_connection (msg);
+
+ soup_connection_message_io_finished (conn, msg);
+ g_signal_handlers_disconnect_by_data(conn, msg);
+ if (completion_cb)
+ completion_cb (G_OBJECT (msg), completion, completion_data);
+ g_object_unref (msg);
+}
+
static void
soup_client_message_io_http1_finished (SoupClientMessageIO *iface,
SoupMessage *msg)
@@ -76,20 +91,17 @@ soup_client_message_io_http1_finished (SoupClientMessageIO *iface,
gpointer completion_data;
SoupMessageIOCompletion completion;
- completion_cb = io->base.completion_cb;
- completion_data = io->base.completion_data;
-
if ((io->base.read_state >= SOUP_MESSAGE_IO_STATE_FINISHING &&
io->base.write_state >= SOUP_MESSAGE_IO_STATE_FINISHING))
completion = SOUP_MESSAGE_IO_COMPLETE;
else
completion = SOUP_MESSAGE_IO_INTERRUPTED;
+ completion_cb = io->base.completion_cb;
+ completion_data = io->base.completion_data;
msg = g_object_ref (msg);
- soup_connection_message_io_finished (soup_message_get_connection (msg), msg);
- if (completion_cb)
- completion_cb (G_OBJECT (msg), completion, completion_data);
- g_object_unref (msg);
+
+ soup_client_message_io_complete (msg, completion, completion_cb, completion_data);
}
static void
@@ -102,12 +114,9 @@ soup_client_message_io_http1_stolen (SoupClientMessageIO *iface)
completion_cb = io->base.completion_cb;
completion_data = io->base.completion_data;
-
msg = g_object_ref (io->item->msg);
- soup_connection_message_io_finished (soup_message_get_connection (msg), msg);
- if (completion_cb)
- completion_cb (G_OBJECT (msg), SOUP_MESSAGE_IO_STOLEN, completion_data);
- g_object_unref (msg);
+
+ soup_client_message_io_complete (msg, SOUP_MESSAGE_IO_STOLEN, completion_cb, completion_data);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]