From 6f5cee8006a6800787e488fce36670e6aa62fa13 Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Sat, 24 Oct 2009 23:23:42 +0400 Subject: [PATCH] session-client: fix SEGV inside disconnect() helper Don't call SmcCloseConnection if no connection is present: we will dereference NULL-pointer in this case and this will provoke SEGV I had seen this problem when I tried to start xfce4 settings-helper without running session manager: it whined that ----- (xfce4-settings-helper:86452): xfce4-settings-helper-WARNING **: Failed to connect to session manager ----- and dumped core afterwards. With this patch I can run the utility without session manager. May be the other clients of libxfcegui4 were affected -- don't currently know. Signed-off-by: Eygene Ryabinkin --- libxfcegui4/session-client.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libxfcegui4/session-client.c b/libxfcegui4/session-client.c index 3c63904..c9c1137 100644 --- a/libxfcegui4/session-client.c +++ b/libxfcegui4/session-client.c @@ -335,9 +335,11 @@ logout_session (SessionClient * session_client) static void disconnect (SessionClient * session_client) { - SmcCloseConnection ((SmcConn) session_client->session_connection, 0, - NULL); - session_client->session_connection = NULL; + if (session_client->session_connection != NULL) { + SmcCloseConnection ((SmcConn) session_client->session_connection, + 0, NULL); + session_client->session_connection = NULL; + } session_client->current_state = SESSION_CLIENT_DISCONNECTED; gdk_set_sm_client_id (NULL); } -- 1.6.4.4