[gtk-vnc] Check if we have a valid socket before trying to close it
- From: Jonh Wendell <jwendell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-vnc] Check if we have a valid socket before trying to close it
- Date: Fri, 27 Aug 2010 15:46:45 +0000 (UTC)
commit 39731831e9167178aef3534bdfe6b6bd6e3ed5f9
Author: Jonh Wendell <jwendell gnome org>
Date: Fri Aug 27 12:42:24 2010 -0300
Check if we have a valid socket before trying to close it
If we attempt to destroy the widget while VncConnection still
is trying to connect to the host, then priv->sock is not valid yet.
src/vncconnection.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index 566f4da..736c94e 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -4397,9 +4397,12 @@ void vnc_connection_shutdown(VncConnection *conn)
priv->open_id = 0;
}
- g_socket_close(priv->sock, NULL);
- g_object_unref(priv->sock);
- priv->sock = NULL;
+ if (priv->sock) {
+ g_socket_close(priv->sock, NULL);
+ g_object_unref(priv->sock);
+ priv->sock = NULL;
+ }
+
priv->fd = -1;
priv->has_error = 1;
VNC_DEBUG("Waking up couroutine to shutdown gracefully");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]