Destroy channel listeners on terminate
This commit is contained in:
parent
5b2a4434d8
commit
2f5e5359f6
@ -687,7 +687,7 @@ static UINT audin_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManag
|
||||
audin->listener_callback->plugin = pPlugin;
|
||||
audin->listener_callback->channel_mgr = pChannelMgr;
|
||||
return pChannelMgr->CreateListener(pChannelMgr, "AUDIO_INPUT", 0,
|
||||
(IWTSListenerCallback*)audin->listener_callback, NULL);
|
||||
&audin->listener_callback->iface, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -704,6 +704,13 @@ static UINT audin_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
|
||||
|
||||
WLog_Print(audin->log, WLOG_TRACE, "...");
|
||||
|
||||
if (audin->listener_callback)
|
||||
{
|
||||
IWTSVirtualChannelManager* mgr = audin->listener_callback->channel_mgr;
|
||||
if (mgr)
|
||||
IFCALL(mgr->DestroyListener, mgr, &audin->iface);
|
||||
}
|
||||
audio_formats_free(audin->fixed_format, 1);
|
||||
|
||||
if (audin->device)
|
||||
|
@ -308,8 +308,7 @@ static UINT disp_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManage
|
||||
disp->listener_callback->plugin = pPlugin;
|
||||
disp->listener_callback->channel_mgr = pChannelMgr;
|
||||
status = pChannelMgr->CreateListener(pChannelMgr, DISP_DVC_CHANNEL_NAME, 0,
|
||||
(IWTSListenerCallback*)disp->listener_callback,
|
||||
&(disp->listener));
|
||||
&disp->listener_callback->iface, &(disp->listener));
|
||||
disp->listener->pInterface = disp->iface.pInterface;
|
||||
return status;
|
||||
}
|
||||
@ -322,6 +321,14 @@ static UINT disp_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManage
|
||||
static UINT disp_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
{
|
||||
DISP_PLUGIN* disp = (DISP_PLUGIN*)pPlugin;
|
||||
|
||||
if (disp && disp->listener_callback)
|
||||
{
|
||||
IWTSVirtualChannelManager* mgr = disp->listener_callback->channel_mgr;
|
||||
if (mgr)
|
||||
IFCALL(mgr->DestroyListener, mgr, &disp->iface);
|
||||
}
|
||||
|
||||
free(disp->listener_callback);
|
||||
free(disp->iface.pInterface);
|
||||
free(pPlugin);
|
||||
|
@ -142,8 +142,8 @@ static UINT echo_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManage
|
||||
echo->listener_callback->plugin = pPlugin;
|
||||
echo->listener_callback->channel_mgr = pChannelMgr;
|
||||
|
||||
return pChannelMgr->CreateListener(pChannelMgr, "ECHO", 0,
|
||||
(IWTSListenerCallback*)echo->listener_callback, NULL);
|
||||
return pChannelMgr->CreateListener(pChannelMgr, "ECHO", 0, &echo->listener_callback->iface,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -154,7 +154,12 @@ static UINT echo_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManage
|
||||
static UINT echo_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
{
|
||||
ECHO_PLUGIN* echo = (ECHO_PLUGIN*)pPlugin;
|
||||
|
||||
if (echo && echo->listener_callback)
|
||||
{
|
||||
IWTSVirtualChannelManager* mgr = echo->listener_callback->channel_mgr;
|
||||
if (mgr)
|
||||
IFCALL(mgr->DestroyListener, mgr, &echo->iface);
|
||||
}
|
||||
free(echo);
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
|
@ -410,9 +410,9 @@ static UINT geometry_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMa
|
||||
geometry->listener_callback->iface.OnNewChannelConnection = geometry_on_new_channel_connection;
|
||||
geometry->listener_callback->plugin = pPlugin;
|
||||
geometry->listener_callback->channel_mgr = pChannelMgr;
|
||||
status = pChannelMgr->CreateListener(pChannelMgr, GEOMETRY_DVC_CHANNEL_NAME, 0,
|
||||
(IWTSListenerCallback*)geometry->listener_callback,
|
||||
&(geometry->listener));
|
||||
status =
|
||||
pChannelMgr->CreateListener(pChannelMgr, GEOMETRY_DVC_CHANNEL_NAME, 0,
|
||||
&geometry->listener_callback->iface, &(geometry->listener));
|
||||
geometry->listener->pInterface = geometry->iface.pInterface;
|
||||
return status;
|
||||
}
|
||||
@ -427,6 +427,13 @@ static UINT geometry_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
GEOMETRY_PLUGIN* geometry = (GEOMETRY_PLUGIN*)pPlugin;
|
||||
GeometryClientContext* context = (GeometryClientContext*)geometry->iface.pInterface;
|
||||
|
||||
if (geometry && geometry->listener_callback)
|
||||
{
|
||||
IWTSVirtualChannelManager* mgr = geometry->listener_callback->channel_mgr;
|
||||
if (mgr)
|
||||
IFCALL(mgr->DestroyListener, mgr, &geometry->iface);
|
||||
}
|
||||
|
||||
if (context)
|
||||
HashTable_Free(context->geometries);
|
||||
|
||||
|
@ -571,8 +571,7 @@ static UINT rdpei_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManag
|
||||
rdpei->listener_callback->channel_mgr = pChannelMgr;
|
||||
|
||||
if ((error = pChannelMgr->CreateListener(pChannelMgr, RDPEI_DVC_CHANNEL_NAME, 0,
|
||||
(IWTSListenerCallback*)rdpei->listener_callback,
|
||||
&(rdpei->listener))))
|
||||
&rdpei->listener_callback->iface, &(rdpei->listener))))
|
||||
{
|
||||
WLog_ERR(TAG, "ChannelMgr->CreateListener failed with error %" PRIu32 "!", error);
|
||||
goto error_out;
|
||||
@ -598,6 +597,12 @@ static UINT rdpei_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
if (!pPlugin)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if (rdpei && rdpei->listener_callback)
|
||||
{
|
||||
IWTSVirtualChannelManager* mgr = rdpei->listener_callback->channel_mgr;
|
||||
if (mgr)
|
||||
IFCALL(mgr->DestroyListener, mgr, &rdpei->iface);
|
||||
}
|
||||
free(rdpei->listener_callback);
|
||||
free(rdpei->context);
|
||||
free(rdpei);
|
||||
|
@ -1896,8 +1896,7 @@ static UINT rdpgfx_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMana
|
||||
gfx->listener_callback->plugin = pPlugin;
|
||||
gfx->listener_callback->channel_mgr = pChannelMgr;
|
||||
error = pChannelMgr->CreateListener(pChannelMgr, RDPGFX_DVC_CHANNEL_NAME, 0,
|
||||
(IWTSListenerCallback*)gfx->listener_callback,
|
||||
&(gfx->listener));
|
||||
&gfx->listener_callback->iface, &(gfx->listener));
|
||||
gfx->listener->pInterface = gfx->iface.pInterface;
|
||||
DEBUG_RDPGFX(gfx->log, "Initialize");
|
||||
return error;
|
||||
@ -1913,6 +1912,12 @@ static UINT rdpgfx_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)pPlugin;
|
||||
RdpgfxClientContext* context = (RdpgfxClientContext*)gfx->iface.pInterface;
|
||||
DEBUG_RDPGFX(gfx->log, "Terminated");
|
||||
if (gfx && gfx->listener_callback)
|
||||
{
|
||||
IWTSVirtualChannelManager* mgr = gfx->listener_callback->channel_mgr;
|
||||
if (mgr)
|
||||
IFCALL(mgr->DestroyListener, mgr, &gfx->iface);
|
||||
}
|
||||
rdpgfx_client_context_free(context);
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
@ -1541,8 +1541,7 @@ static UINT rdpsnd_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMana
|
||||
rdpsnd->listener_callback->plugin = pPlugin;
|
||||
rdpsnd->listener_callback->channel_mgr = pChannelMgr;
|
||||
status = pChannelMgr->CreateListener(pChannelMgr, RDPSND_DVC_CHANNEL_NAME, 0,
|
||||
(IWTSListenerCallback*)rdpsnd->listener_callback,
|
||||
&(rdpsnd->listener));
|
||||
&rdpsnd->listener_callback->iface, &(rdpsnd->listener));
|
||||
rdpsnd->listener->pInterface = rdpsnd->iface.pInterface;
|
||||
return rdpsnd_virtual_channel_event_initialized(rdpsnd);
|
||||
}
|
||||
@ -1557,6 +1556,12 @@ static UINT rdpsnd_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
rdpsndPlugin* rdpsnd = (rdpsndPlugin*)pPlugin;
|
||||
if (rdpsnd)
|
||||
{
|
||||
if (rdpsnd->listener_callback)
|
||||
{
|
||||
IWTSVirtualChannelManager* mgr = rdpsnd->listener_callback->channel_mgr;
|
||||
if (mgr)
|
||||
IFCALL(mgr->DestroyListener, mgr, &rdpsnd->iface);
|
||||
}
|
||||
free(rdpsnd->listener_callback);
|
||||
free(rdpsnd->iface.pInterface);
|
||||
}
|
||||
|
@ -709,7 +709,12 @@ static UINT urbdrc_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
|
||||
if (!urbdrc)
|
||||
return ERROR_INVALID_DATA;
|
||||
|
||||
if (urbdrc->listener_callback)
|
||||
{
|
||||
IWTSVirtualChannelManager* mgr = urbdrc->listener_callback->channel_mgr;
|
||||
if (mgr)
|
||||
IFCALL(mgr->DestroyListener, mgr, &urbdrc->iface);
|
||||
}
|
||||
udevman = urbdrc->udevman;
|
||||
|
||||
if (udevman)
|
||||
|
@ -1048,7 +1048,7 @@ static UINT video_plugin_initialize(IWTSPlugin* plugin, IWTSVirtualChannelManage
|
||||
callback->channel_mgr = channelMgr;
|
||||
|
||||
status = channelMgr->CreateListener(channelMgr, VIDEO_CONTROL_DVC_CHANNEL_NAME, 0,
|
||||
(IWTSListenerCallback*)callback, &(video->controlListener));
|
||||
&callback->iface, &(video->controlListener));
|
||||
|
||||
if (status != CHANNEL_RC_OK)
|
||||
return status;
|
||||
@ -1067,7 +1067,7 @@ static UINT video_plugin_initialize(IWTSPlugin* plugin, IWTSVirtualChannelManage
|
||||
callback->channel_mgr = channelMgr;
|
||||
|
||||
status = channelMgr->CreateListener(channelMgr, VIDEO_DATA_DVC_CHANNEL_NAME, 0,
|
||||
(IWTSListenerCallback*)callback, &(video->dataListener));
|
||||
&callback->iface, &(video->dataListener));
|
||||
|
||||
if (status == CHANNEL_RC_OK)
|
||||
video->dataListener->pInterface = video->wtsPlugin.pInterface;
|
||||
@ -1084,6 +1084,19 @@ static UINT video_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
{
|
||||
VIDEO_PLUGIN* video = (VIDEO_PLUGIN*)pPlugin;
|
||||
|
||||
if (video->control_callback)
|
||||
{
|
||||
IWTSVirtualChannelManager* mgr = video->control_callback->channel_mgr;
|
||||
if (mgr)
|
||||
IFCALL(mgr->DestroyListener, mgr, &video->control_callback->iface);
|
||||
}
|
||||
if (video->data_callback)
|
||||
{
|
||||
IWTSVirtualChannelManager* mgr = video->data_callback->channel_mgr;
|
||||
if (mgr)
|
||||
IFCALL(mgr->DestroyListener, mgr, &video->data_callback->iface);
|
||||
}
|
||||
|
||||
if (video->context)
|
||||
VideoClientContextPriv_free(video->context->priv);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user