From f589d5d6e0bb9181ebb7803ba31eb153531570bc Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Tue, 14 Jul 2015 15:28:55 +0200 Subject: [PATCH] x11: reorder xf_post_disconnect Channels like EGFX need resources like the main window in order to work correctly. Before the window, GDI,.. is freed it needs to be ensured that all channels are stopped properly to prevent them to access already freed resources. Disconnecting the channels first fixed a possible race condition/SEGFAULT that could occur with remote initiated disconnects. --- client/X11/xf_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index 1461e86db..ba070a63d 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -1195,6 +1195,8 @@ static void xf_post_disconnect(freerdp* instance) context = instance->context; xfc = (xfContext*) context; + freerdp_channels_disconnect(context->channels, instance); + gdi_free(instance); if (xfc->clipboard) @@ -1212,8 +1214,6 @@ static void xf_post_disconnect(freerdp* instance) } xf_keyboard_free(xfc); - - freerdp_channels_disconnect(context->channels, instance); } /** Callback set in the rdp_freerdp structure, and used to get the user's password,