summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2022-10-12 08:45:40 +0200
committerCarlos Garcia Campos <carlosgc@gnome.org>2022-10-14 12:01:52 +0000
commit5ce3a206aeaab8c01431ead75ea8107729447d8b (patch)
tree1bc978583a48f3a36ca03e0f2f210cb9d86e65b3
parent1d5b651ff5364f0024903cf2b0ef6a4e3d7258ef (diff)
downloadlibsoup-5ce3a206aeaab8c01431ead75ea8107729447d8b.tar.gz
server-connection: attach a ref of the socket to io stream on steal
Previously we transferred the ownership of the socket to the io stream, but now we keep the ref in the connection that can be disposed before the io stream.
-rw-r--r--libsoup/server/soup-server-connection.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libsoup/server/soup-server-connection.c b/libsoup/server/soup-server-connection.c
index ac0f1aaa..380ac42b 100644
--- a/libsoup/server/soup-server-connection.c
+++ b/libsoup/server/soup-server-connection.c
@@ -549,9 +549,10 @@ soup_server_connection_steal (SoupServerConnection *conn)
priv = soup_server_connection_get_instance_private (conn);
stream = priv->io_data ? soup_server_message_io_steal (priv->io_data) : NULL;
- if (stream) {
+ if (stream && priv->socket) {
g_object_set_data_full (G_OBJECT (stream), "GSocket",
- priv->socket, g_object_unref);
+ g_object_ref (priv->socket),
+ g_object_unref);
}
/* Cache local and remote address */