From f2f0b1b3cf6b9b6f0ac51d6a20a9b739b2d4c006 Mon Sep 17 00:00:00 2001 From: keis Date: Wed, 5 Jan 2011 02:19:40 +0100 Subject: unref IOChannel after shutdown --- src/uzbl-core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/uzbl-core.c b/src/uzbl-core.c index c6813ea..c451f86 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -1692,13 +1692,12 @@ gboolean remove_socket_from_array(GIOChannel *chan) { gboolean ret = 0; - /* TODO: Do wee need to manually free the IO channel or is this - * happening implicitly on unref? - */ ret = g_ptr_array_remove_fast(uzbl.comm.connect_chan, chan); if(!ret) ret = g_ptr_array_remove_fast(uzbl.comm.client_chan, chan); + if(ret) + g_io_channel_unref (chan); return ret; } @@ -1772,17 +1771,17 @@ control_client_socket(GIOChannel *clientchan) { if (ret == G_IO_STATUS_ERROR) { g_warning ("Error reading: %s", error->message); g_clear_error (&error); - remove_socket_from_array (clientchan); ret = g_io_channel_shutdown (clientchan, TRUE, &error); + remove_socket_from_array (clientchan); if (ret == G_IO_STATUS_ERROR) { g_warning ("Error closing: %s", error->message); g_clear_error (&error); } return FALSE; } else if (ret == G_IO_STATUS_EOF) { - remove_socket_from_array (clientchan); /* shutdown and remove channel watch from main loop */ ret = g_io_channel_shutdown (clientchan, TRUE, &error); + remove_socket_from_array (clientchan); if (ret == G_IO_STATUS_ERROR) { g_warning ("Error closing: %s", error->message); g_clear_error (&error); -- cgit v1.2.3