[libsoup] Keep reference on SoupSocket while emitting signals
- From: Dan Winship <danw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libsoup] Keep reference on SoupSocket while emitting signals
- Date: Sat, 12 Sep 2009 11:31:54 +0000 (UTC)
commit bf89ea026547838ca8e4804550ec2337f9574c9a
Author: Olivier Crête <olivier crete collabora co uk>
Date: Fri Sep 11 19:04:10 2009 -0400
Keep reference on SoupSocket while emitting signals
The socket could have its last external referenced dropped by
soup_message_io_cleanup() during the "readable" signal and then
abort() when trying to emit the "disconnected" signal.
https://bugzilla.gnome.org/show_bug.cgi?id=594951
libsoup/soup-socket.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c
index e804e27..883e943 100644
--- a/libsoup/soup-socket.c
+++ b/libsoup/soup-socket.c
@@ -1058,6 +1058,11 @@ soup_socket_disconnect (SoupSocket *sock)
if (already_disconnected)
return;
+ /* Keep ref around signals in case the object is unreferenced
+ * in a handler
+ */
+ g_object_ref (sock);
+
/* Give all readers a chance to notice the connection close */
g_signal_emit (sock, signals[READABLE], 0);
@@ -1065,6 +1070,8 @@ soup_socket_disconnect (SoupSocket *sock)
/* Then let everyone know we're disconnected */
g_signal_emit (sock, signals[DISCONNECTED], 0);
+
+ g_object_unref (sock);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]