diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index 9746853e2..4bf2c9c1b 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -1411,6 +1411,18 @@ static void xf_post_disconnect(freerdp* instance) xf_keyboard_free(xfc); } +static void xf_post_final_disconnect(freerdp* instance) +{ + xfContext* xfc; + rdpContext* context; + + if (!instance || !instance->context) + return; + + context = instance->context; + xfc = (xfContext*)context; +} + static int xf_logon_error_info(freerdp* instance, UINT32 data, UINT32 type) { xfContext* xfc = (xfContext*)instance->context; @@ -1753,6 +1765,7 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context) instance->PreConnect = xf_pre_connect; instance->PostConnect = xf_post_connect; instance->PostDisconnect = xf_post_disconnect; + instance->PostFinalDisconnect = xf_post_final_disconnect; instance->AuthenticateEx = client_cli_authenticate_ex; instance->ChooseSmartcard = client_cli_choose_smartcard; instance->VerifyCertificateEx = client_cli_verify_certificate_ex; diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h index 77b4b2732..030713871 100644 --- a/include/freerdp/freerdp.h +++ b/include/freerdp/freerdp.h @@ -460,7 +460,11 @@ owned by rdpRdp */ ALIGN64 pPostDisconnect PostDisconnect; /**< (offset 55) Callback for cleaning up - resources allocated by connect callbacks. */ + resources allocated by post connect callback. + + This will be called before disconnecting and cleaning up the + channels. + */ ALIGN64 pAuthenticate GatewayAuthenticate; /**< (offset 56) Callback for gateway authentication. @@ -482,7 +486,14 @@ owned by rdpRdp */ * callback for loading channel configuration. Might be called multiple * times when redirection occurs. */ - UINT64 paddingD[64 - 60]; /* 60 */ + ALIGN64 pPostDisconnect + PostFinalDisconnect; /** < (offset 60) + * callback for cleaning up resources allocated in PreConnect + * + * This will be called after all instance related channels and + * threads have been stopped + */ + UINT64 paddingD[64 - 61]; /* 61 */ ALIGN64 pSendChannelData SendChannelData; /* (offset 64) diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c index dc59b7105..6c9167dec 100644 --- a/libfreerdp/core/freerdp.c +++ b/libfreerdp/core/freerdp.c @@ -549,6 +549,9 @@ BOOL freerdp_disconnect(freerdp* instance) } freerdp_channels_close(instance->context->channels, instance); + + IFCALL(instance->PostFinalDisconnect, instance); + return rc; }