aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/uzbl-core.c
diff options
context:
space:
mode:
authorGravatar Brendan Taylor <whateley@gmail.com>2011-01-06 17:03:36 -0700
committerGravatar Brendan Taylor <whateley@gmail.com>2011-01-06 17:03:36 -0700
commit94bfc85404e3b4c8332245629b6c6e1145200023 (patch)
tree8cb9854ca4f327004e11386b6da38255268f16dd /src/uzbl-core.c
parentc60e5b1c082b2322567e32d31d010a29e79f97b1 (diff)
parent2a53b3b14765af687312ebf36d19171189359b22 (diff)
Merge remote branch 'keis/io-shutdown-fix' into experimental
Diffstat (limited to 'src/uzbl-core.c')
-rw-r--r--src/uzbl-core.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index 4a1b071..c8caa5a 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -1694,13 +1694,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,14 +1771,23 @@ control_client_socket(GIOChannel *clientchan) {
ret = g_io_channel_read_line(clientchan, &ctl_line, &len, NULL, &error);
if (ret == G_IO_STATUS_ERROR) {
- g_warning ("Error reading: %s\n", error->message);
- remove_socket_from_array(clientchan);
- g_io_channel_shutdown(clientchan, TRUE, &error);
+ g_warning ("Error reading: %s", error->message);
+ g_clear_error (&error);
+ 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 */
- g_io_channel_shutdown(clientchan, TRUE, &error);
+ 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;
}
@@ -1790,11 +1798,14 @@ control_client_socket(GIOChannel *clientchan) {
&len, &error);
if (ret == G_IO_STATUS_ERROR) {
g_warning ("Error writing: %s", error->message);
+ g_clear_error (&error);
+ }
+ if (g_io_channel_flush(clientchan, &error) == G_IO_STATUS_ERROR) {
+ g_warning ("Error flushing: %s", error->message);
+ g_clear_error (&error);
}
- g_io_channel_flush(clientchan, &error);
}
- if (error) g_error_free (error);
g_string_free(result, TRUE);
g_free(ctl_line);
return TRUE;