Fixed DestroyListener arguments and call order

This commit is contained in:
akallabeth 2020-05-12 14:26:45 +02:00 committed by akallabeth
parent 5cfc3e8593
commit 64ad42b95b
11 changed files with 26 additions and 25 deletions

View File

@ -100,6 +100,8 @@ struct _AUDIN_PLUGIN
FREERDP_DSP_CONTEXT* dsp_context;
wLog* log;
IWTSListener* listener;
};
static BOOL audin_process_addin_args(AUDIN_PLUGIN* audin, ADDIN_ARGV* args);
@ -687,7 +689,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,
&audin->listener_callback->iface, NULL);
&audin->listener_callback->iface, &audin->listener);
}
/**
@ -709,7 +711,7 @@ static UINT audin_plugin_terminated(IWTSPlugin* pPlugin)
{
IWTSVirtualChannelManager* mgr = audin->listener_callback->channel_mgr;
if (mgr)
IFCALL(mgr->DestroyListener, mgr, &audin->iface);
IFCALL(mgr->DestroyListener, mgr, audin->listener);
}
audio_formats_free(audin->fixed_format, 1);

View File

@ -326,7 +326,7 @@ static UINT disp_plugin_terminated(IWTSPlugin* pPlugin)
{
IWTSVirtualChannelManager* mgr = disp->listener_callback->channel_mgr;
if (mgr)
IFCALL(mgr->DestroyListener, mgr, &disp->iface);
IFCALL(mgr->DestroyListener, mgr, disp->listener);
}
free(disp->listener_callback);

View File

@ -40,6 +40,7 @@ static void dvcman_wtslistener_free(DVCMAN_LISTENER* listener)
{
if (listener)
free(listener->channel_name);
free(listener);
}
@ -217,6 +218,11 @@ static void dvcman_plugin_terminate(void* plugin)
WLog_ERR(TAG, "Terminated failed with error %" PRIu32 "!", error);
}
static void wts_listener_free(void* arg)
{
DVCMAN_LISTENER* listener = (DVCMAN_LISTENER*)arg;
dvcman_wtslistener_free(listener);
}
static IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin)
{
wObject* obj;
@ -248,7 +254,7 @@ static IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin)
if (!dvcman->listeners)
goto fail;
obj = ArrayList_Object(dvcman->listeners);
obj->fnObjectFree = dvcman_wtslistener_free;
obj->fnObjectFree = wts_listener_free;
dvcman->plugin_names = ArrayList_New(TRUE);
if (!dvcman->plugin_names)
@ -378,10 +384,10 @@ static void dvcman_free(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChan
{
DVCMAN* dvcman = (DVCMAN*)pChannelMgr;
ArrayList_Free(dvcman->listeners);
ArrayList_Free(dvcman->plugins);
ArrayList_Free(dvcman->channels);
ArrayList_Free(dvcman->plugin_names);
ArrayList_Free(dvcman->plugins);
ArrayList_Free(dvcman->listeners);
StreamPool_Free(dvcman->pool);
free(dvcman);
@ -580,7 +586,6 @@ static UINT dvcman_open_channel(drdynvcPlugin* drdynvc, IWTSVirtualChannelManage
static UINT dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId,
BOOL bSendClosePDU)
{
size_t i;
DVCMAN_CHANNEL* channel;
UINT error = CHANNEL_RC_OK;
DVCMAN* dvcman = (DVCMAN*)pChannelMgr;
@ -614,14 +619,6 @@ static UINT dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32
}
}
ArrayList_Lock(dvcman->listeners);
for (i = ArrayList_Count(dvcman->listeners); i > 0; i--)
{
DVCMAN_LISTENER* listener = ArrayList_GetItem(dvcman->listeners, i - 1);
if (strcmp(listener->channel_name, channel->channel_name) == 0)
ArrayList_Remove(dvcman->listeners, listener);
}
ArrayList_Unlock(dvcman->listeners);
ArrayList_Remove(dvcman->channels, channel);
return error;
}

View File

@ -59,6 +59,7 @@ struct _ECHO_PLUGIN
IWTSPlugin iface;
ECHO_LISTENER_CALLBACK* listener_callback;
IWTSListener* listener;
};
/**
@ -143,7 +144,7 @@ static UINT echo_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManage
echo->listener_callback->channel_mgr = pChannelMgr;
return pChannelMgr->CreateListener(pChannelMgr, "ECHO", 0, &echo->listener_callback->iface,
NULL);
&echo->listener);
}
/**
@ -158,7 +159,7 @@ static UINT echo_plugin_terminated(IWTSPlugin* pPlugin)
{
IWTSVirtualChannelManager* mgr = echo->listener_callback->channel_mgr;
if (mgr)
IFCALL(mgr->DestroyListener, mgr, &echo->iface);
IFCALL(mgr->DestroyListener, mgr, echo->listener);
}
free(echo);

View File

@ -431,7 +431,7 @@ static UINT geometry_plugin_terminated(IWTSPlugin* pPlugin)
{
IWTSVirtualChannelManager* mgr = geometry->listener_callback->channel_mgr;
if (mgr)
IFCALL(mgr->DestroyListener, mgr, &geometry->iface);
IFCALL(mgr->DestroyListener, mgr, geometry->listener);
}
if (context)

View File

@ -601,7 +601,7 @@ static UINT rdpei_plugin_terminated(IWTSPlugin* pPlugin)
{
IWTSVirtualChannelManager* mgr = rdpei->listener_callback->channel_mgr;
if (mgr)
IFCALL(mgr->DestroyListener, mgr, &rdpei->iface);
IFCALL(mgr->DestroyListener, mgr, rdpei->listener);
}
free(rdpei->listener_callback);
free(rdpei->context);

View File

@ -1916,7 +1916,7 @@ static UINT rdpgfx_plugin_terminated(IWTSPlugin* pPlugin)
{
IWTSVirtualChannelManager* mgr = gfx->listener_callback->channel_mgr;
if (mgr)
IFCALL(mgr->DestroyListener, mgr, &gfx->iface);
IFCALL(mgr->DestroyListener, mgr, gfx->listener);
}
rdpgfx_client_context_free(context);
return CHANNEL_RC_OK;

View File

@ -1560,7 +1560,7 @@ static UINT rdpsnd_plugin_terminated(IWTSPlugin* pPlugin)
{
IWTSVirtualChannelManager* mgr = rdpsnd->listener_callback->channel_mgr;
if (mgr)
IFCALL(mgr->DestroyListener, mgr, &rdpsnd->iface);
IFCALL(mgr->DestroyListener, mgr, rdpsnd->listener);
}
free(rdpsnd->listener_callback);
free(rdpsnd->iface.pInterface);

View File

@ -687,7 +687,7 @@ static UINT urbdrc_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMana
/* [MS-RDPEUSB] 2.1 Transport defines the channel name in uppercase letters */
CharUpperA(channelName);
status = pChannelMgr->CreateListener(pChannelMgr, channelName, 0,
&urbdrc->listener_callback->iface, NULL);
&urbdrc->listener_callback->iface, &urbdrc->listener);
if (status != CHANNEL_RC_OK)
return status;
@ -713,7 +713,7 @@ static UINT urbdrc_plugin_terminated(IWTSPlugin* pPlugin)
{
IWTSVirtualChannelManager* mgr = urbdrc->listener_callback->channel_mgr;
if (mgr)
IFCALL(mgr->DestroyListener, mgr, &urbdrc->iface);
IFCALL(mgr->DestroyListener, mgr, urbdrc->listener);
}
udevman = urbdrc->udevman;

View File

@ -84,6 +84,7 @@ struct _URBDRC_PLUGIN
char* subsystem;
wLog* log;
IWTSListener* listener;
};
typedef BOOL (*PREGISTERURBDRCSERVICE)(IWTSPlugin* plugin, IUDEVMAN* udevman);

View File

@ -1088,13 +1088,13 @@ static UINT video_plugin_terminated(IWTSPlugin* pPlugin)
{
IWTSVirtualChannelManager* mgr = video->control_callback->channel_mgr;
if (mgr)
IFCALL(mgr->DestroyListener, mgr, &video->control_callback->iface);
IFCALL(mgr->DestroyListener, mgr, video->controlListener);
}
if (video->data_callback)
{
IWTSVirtualChannelManager* mgr = video->data_callback->channel_mgr;
if (mgr)
IFCALL(mgr->DestroyListener, mgr, &video->data_callback->iface);
IFCALL(mgr->DestroyListener, mgr, video->dataListener);
}
if (video->context)