From 1761a66b5e12c9c895a44bc18f08d1e93090b6d6 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 9 Apr 2018 11:10:03 +0200 Subject: [PATCH] Fixed channel duplicate disconnect handling --- channels/rail/client/rail_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/channels/rail/client/rail_main.c b/channels/rail/client/rail_main.c index 6671f48fd..1373b8a2a 100644 --- a/channels/rail/client/rail_main.c +++ b/channels/rail/client/rail_main.c @@ -682,7 +682,7 @@ static UINT rail_virtual_channel_event_connected(railPlugin* rail, LPVOID pData, } if (!(rail->thread = CreateThread(NULL, 0, - rail_virtual_channel_client_thread, (void*) rail, 0, + rail_virtual_channel_client_thread, (void*) rail, 0, NULL))) { WLog_ERR(TAG, "CreateThread failed!"); @@ -703,6 +703,9 @@ static UINT rail_virtual_channel_event_disconnected(railPlugin* rail) { UINT rc; + if (rail->OpenHandle == 0) + return CHANNEL_RC_OK; + if (MessageQueue_PostQuit(rail->queue, 0) && (WaitForSingleObject(rail->thread, INFINITE) == WAIT_FAILED)) {