Merge pull request #2255 from awakecoding/master

Memory Leak/Corruption Fixes, PulseAudio Detection Fixes
This commit is contained in:
Marc-André Moreau 2014-12-04 14:13:15 -05:00
commit ced1ab979f
21 changed files with 181 additions and 103 deletions

View File

@ -409,6 +409,8 @@ static void cliprdr_order_recv(cliprdrPlugin* cliprdr, wStream* s)
WLog_ERR(TAG, "unknown msgType %d", msgType);
break;
}
Stream_Free(s, TRUE);
}
/**
@ -890,6 +892,8 @@ static void cliprdr_virtual_channel_event_terminated(cliprdrPlugin* cliprdr)
cliprdr_remove_open_handle_data(cliprdr->OpenHandle);
cliprdr_remove_init_handle_data(cliprdr->InitHandle);
free(cliprdr);
}
static VOID VCAPITYPE cliprdr_virtual_channel_init_event(LPVOID pInitHandle, UINT event, LPVOID pData, UINT dataLength)

View File

@ -620,6 +620,9 @@ static void drive_free(DEVICE* device)
CloseHandle(drive->thread);
ListDictionary_Free(drive->files);
MessageQueue_Free(drive->IrpQueue);
Stream_Free(drive->device.data, TRUE);
free(drive);
}

View File

@ -999,6 +999,8 @@ static void rdpdr_virtual_channel_event_terminated(rdpdrPlugin* rdpdr)
rdpdr_remove_open_handle_data(rdpdr->OpenHandle);
rdpdr_remove_init_handle_data(rdpdr->InitHandle);
free(rdpdr);
}
static VOID VCAPITYPE rdpdr_virtual_channel_init_event(LPVOID pInitHandle, UINT event, LPVOID pData, UINT dataLength)

View File

@ -1010,6 +1010,8 @@ static void rdpsnd_virtual_channel_event_terminated(rdpsndPlugin* rdpsnd)
rdpsnd->data_in = NULL;
}
MessagePipe_Free(rdpsnd->MsgPipe);
if (rdpsnd->device)
IFCALL(rdpsnd->device->Free, rdpsnd->device);
@ -1029,6 +1031,8 @@ static void rdpsnd_virtual_channel_event_terminated(rdpsndPlugin* rdpsnd)
rdpsnd_remove_open_handle_data(rdpsnd->OpenHandle);
rdpsnd_remove_init_handle_data(rdpsnd->InitHandle);
free(rdpsnd);
}
static VOID VCAPITYPE rdpsnd_virtual_channel_init_event(LPVOID pInitHandle, UINT event, LPVOID pData, UINT dataLength)
@ -1065,12 +1069,10 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
{
rdpsndPlugin* rdpsnd;
rdpsnd = (rdpsndPlugin*) malloc(sizeof(rdpsndPlugin));
rdpsnd = (rdpsndPlugin*) calloc(1, sizeof(rdpsndPlugin));
if (rdpsnd)
{
ZeroMemory(rdpsnd, sizeof(rdpsndPlugin));
#if !defined(_WIN32) && !defined(ANDROID)
{
sigset_t mask;

View File

@ -156,6 +156,8 @@ static int remdesk_send_ctl_version_info_pdu(RemdeskServerContext* context)
remdesk_virtual_channel_write(context, s);
Stream_Free(s, TRUE);
return 1;
}

View File

@ -1618,7 +1618,6 @@ void* xf_thread(void *param)
if (!exit_code)
exit_code = freerdp_error_info(instance);
freerdp_channels_free(channels);
freerdp_disconnect(instance);
gdi_free(instance);
@ -1797,6 +1796,12 @@ static void xfreerdp_client_free(freerdp* instance, rdpContext* context)
if (xfc->display)
XCloseDisplay(xfc->display);
if (context->channels)
{
freerdp_channels_free(context->channels);
context->channels = NULL;
}
}
}

View File

@ -296,6 +296,7 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL hasDa
{
case CF_TEXT:
case CF_UNICODETEXT:
size = strlen((char*) data) + 1;
formatId = ClipboardGetFormatId(clipboard->system, "UTF8_STRING");
break;
@ -304,6 +305,7 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL hasDa
break;
case CB_FORMAT_HTML:
size = strlen((char*) data) + 1;
formatId = ClipboardGetFormatId(clipboard->system, "text/html");
break;
}
@ -317,8 +319,9 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL hasDa
CopyMemory(pSrcData, data, SrcSize);
bSuccess = ClipboardSetData(clipboard->system, formatId, (void*) pSrcData, SrcSize);
if (!bSuccess)
free (pSrcData);
free(pSrcData);
pFormatIds = NULL;
count = ClipboardGetFormatIds(clipboard->system, &pFormatIds);
@ -367,6 +370,7 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL hasDa
}
xf_cliprdr_send_data_response(clipboard, pDstData, (int) DstSize);
free(pDstData);
}
static BOOL xf_cliprdr_get_requested_data(xfClipboard* clipboard, Atom target)
@ -398,6 +402,7 @@ static BOOL xf_cliprdr_get_requested_data(xfClipboard* clipboard, Atom target)
XFree(data);
data = NULL;
}
if (bytes_left <= 0 && !clipboard->incr_starts)
{
@ -994,6 +999,7 @@ static int xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
CopyMemory(pSrcData, data, SrcSize);
bSuccess = ClipboardSetData(clipboard->system, formatId, (void*) pSrcData, SrcSize);
if (!bSuccess)
free (pSrcData);
@ -1142,6 +1148,12 @@ void xf_clipboard_free(xfClipboard* clipboard)
clipboard->serverFormats = NULL;
}
if (clipboard->numClientFormats)
{
for (i = 0; i < clipboard->numClientFormats; i++)
free(clipboard->clientFormats[i].formatName);
}
ClipboardDestroy(clipboard->system);
free(clipboard->data);

View File

@ -2089,12 +2089,25 @@ int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
}
}
if (settings->LyncRdpMode)
{
settings->EncomspVirtualChannel = TRUE;
settings->RemdeskVirtualChannel = TRUE;
settings->CompressionEnabled = FALSE;
}
if (settings->RemoteAssistanceMode)
{
freerdp_client_load_static_channel_addin(channels, settings, "encomsp", settings);
freerdp_client_load_static_channel_addin(channels, settings, "remdesk", settings);
settings->EncomspVirtualChannel = TRUE;
settings->RemdeskVirtualChannel = TRUE;
}
if (settings->EncomspVirtualChannel)
freerdp_client_load_static_channel_addin(channels, settings, "encomsp", settings);
if (settings->RemdeskVirtualChannel)
freerdp_client_load_static_channel_addin(channels, settings, "remdesk", settings);
for (index = 0; index < settings->StaticChannelCount; index++)
{
args = settings->StaticChannelArray[index];

View File

@ -10,5 +10,21 @@ find_library(PULSE_LIBRARY pulse PATHS ${PULSE_LIBRARY_DIRS})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pulse DEFAULT_MSG PULSE_INCLUDE_DIR PULSE_LIBRARY)
mark_as_advanced(PULSE_INCLUDE_DIR PULSE_LIBRARY)
if(PULSE_LIBRARY)
file(STRINGS "${PULSE_INCLUDE_DIR}/pulse/version.h" STR1 REGEX "PA_MAJOR")
file(STRINGS "${PULSE_INCLUDE_DIR}/pulse/version.h" STR2 REGEX "PA_MINOR")
file(STRINGS "${PULSE_INCLUDE_DIR}/pulse/version.h" STR3 REGEX "PA_MICRO")
string(REGEX MATCHALL "[0-9]+" PULSE_VERSION_MAJOR ${STR1})
string(REGEX MATCHALL "[0-9]+" PULSE_VERSION_MINOR ${STR2})
string(REGEX MATCHALL "[0-9]+" PULSE_VERSION_PATCH ${STR3})
if(PULSE_VERSION_PATCH EQUAL 0)
set(PULSE_VERSION "${PULSE_VERSION_MAJOR}.${PULSE_VERSION_MINOR}")
else()
set(PULSE_VERSION "${PULSE_VERSION_MAJOR}.${PULSE_VERSION_MINOR}.${PULSE_VERSION_PATCH}")
endif()
endif()
mark_as_advanced(PULSE_INCLUDE_DIR PULSE_LIBRARY PULSE_VERSION PULSE_VERSION_MAJOR PULSE_VERSION_MINOR PULSE_VERSION_PATCH)

View File

@ -43,7 +43,6 @@ FREERDP_API int freerdp_channels_post_connect(rdpChannels* channels, freerdp* in
FREERDP_API BOOL freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** read_fds,
int* read_count, void** write_fds, int* write_count);
FREERDP_API BOOL freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance);
FREERDP_API wMessage* freerdp_channels_pop_event(rdpChannels* channels);
FREERDP_API void freerdp_channels_close(rdpChannels* channels, freerdp* instance);
FREERDP_API void* freerdp_channels_get_static_channel_interface(rdpChannels* channels, const char* name);

View File

@ -599,6 +599,9 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL;
#define FreeRDP_RemoteAssistancePassStub 1026
#define FreeRDP_RemoteAssistancePassword 1027
#define FreeRDP_RemoteAssistanceRCTicket 1028
#define FreeRDP_EncomspVirtualChannel 1029
#define FreeRDP_RemdeskVirtualChannel 1030
#define FreeRDP_LyncRdpMode 1031
#define FreeRDP_TlsSecurity 1088
#define FreeRDP_NlaSecurity 1089
#define FreeRDP_RdpSecurity 1090
@ -972,7 +975,10 @@ struct rdp_settings
ALIGN64 char* RemoteAssistancePassStub; /* 1026 */
ALIGN64 char* RemoteAssistancePassword; /* 1027 */
ALIGN64 char* RemoteAssistanceRCTicket; /* 1028 */
UINT64 padding1088[1088 - 1029]; /* 1029 */
ALIGN64 BOOL EncomspVirtualChannel; /* 1029 */
ALIGN64 BOOL RemdeskVirtualChannel; /* 1030 */
ALIGN64 BOOL LyncRdpMode; /* 1031 */
UINT64 padding1088[1088 - 1032]; /* 1032 */
/**
* X.224 Connection Request/Confirm

View File

@ -150,7 +150,7 @@ void update_process_glyph_fragments(rdpContext* context, BYTE* data, UINT32 leng
size = data[index + 2];
fragments = (BYTE*) malloc(size);
memcpy(fragments, data, size);
CopyMemory(fragments, data, size);
glyph_cache_fragment_put(glyph_cache, id, size, fragments);
index += 3;
@ -494,14 +494,12 @@ rdpGlyphCache* glyph_cache_new(rdpSettings* settings)
{
rdpGlyphCache* glyphCache;
glyphCache = (rdpGlyphCache*) malloc(sizeof(rdpGlyphCache));
glyphCache = (rdpGlyphCache*) calloc(1, sizeof(rdpGlyphCache));
if (glyphCache)
{
int i;
ZeroMemory(glyphCache, sizeof(rdpGlyphCache));
WLog_Init();
glyphCache->log = WLog_Get("com.freerdp.cache.glyph");
@ -512,12 +510,10 @@ rdpGlyphCache* glyph_cache_new(rdpSettings* settings)
{
glyphCache->glyphCache[i].number = settings->GlyphCache[i].cacheEntries;
glyphCache->glyphCache[i].maxCellSize = settings->GlyphCache[i].cacheMaximumCellSize;
glyphCache->glyphCache[i].entries = (rdpGlyph**) malloc(sizeof(rdpGlyph*) * glyphCache->glyphCache[i].number);
ZeroMemory(glyphCache->glyphCache[i].entries, sizeof(rdpGlyph*) * glyphCache->glyphCache[i].number);
glyphCache->glyphCache[i].entries = (rdpGlyph**) calloc(glyphCache->glyphCache[i].number, sizeof(rdpGlyph*));
}
glyphCache->fragCache.entries = malloc(sizeof(FRAGMENT_CACHE_ENTRY) * 256);
ZeroMemory(glyphCache->fragCache.entries, sizeof(FRAGMENT_CACHE_ENTRY) * 256);
glyphCache->fragCache.entries = calloc(256, sizeof(FRAGMENT_CACHE_ENTRY));
}
return glyphCache;
@ -555,10 +551,9 @@ void glyph_cache_free(rdpGlyphCache* glyphCache)
glyphCache->glyphCache[i].entries = NULL;
}
for (i = 0; i < 255; i++)
for (i = 0; i < 256; i++)
{
fragment = glyphCache->fragCache.entries[i].fragment;
free(fragment);
free(glyphCache->fragCache.entries[i].fragment);
glyphCache->fragCache.entries[i].fragment = NULL;
}

View File

@ -98,8 +98,22 @@ rdpChannels* freerdp_channels_new(void)
void freerdp_channels_free(rdpChannels* channels)
{
int index;
CHANNEL_OPEN_DATA* pChannelOpenData;
MessagePipe_Free(channels->MsgPipe);
for (index = 0; index < channels->clientDataCount; index++)
{
pChannelOpenData = &channels->openDataList[index];
if (pChannelOpenData->pInterface)
{
free(pChannelOpenData->pInterface);
pChannelOpenData->pInterface = NULL;
}
}
free(channels);
}
@ -265,7 +279,6 @@ static int freerdp_channels_process_sync(rdpChannels* channels, freerdp* instanc
{
int status = TRUE;
wMessage message;
wMessage* event;
rdpMcsChannel* channel;
CHANNEL_OPEN_EVENT* item;
CHANNEL_OPEN_DATA* pChannelOpenData;
@ -302,8 +315,6 @@ static int freerdp_channels_process_sync(rdpChannels* channels, freerdp* instanc
}
else if (message.id == 1)
{
event = (wMessage*) message.wParam;
/**
* Ignore for now, the same event is being pushed on the In queue,
* and we're pushing it on the Out queue just to wake other threads
@ -384,22 +395,6 @@ BOOL freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance)
return TRUE;
}
wMessage* freerdp_channels_pop_event(rdpChannels* channels)
{
wMessage message;
wMessage* event = NULL;
if (MessageQueue_Peek(channels->MsgPipe->In, &message, TRUE))
{
if (message.id == 1)
{
event = (wMessage*) message.wParam;
}
}
return event;
}
void freerdp_channels_close(rdpChannels* channels, freerdp* instance)
{
int index;

View File

@ -1623,47 +1623,46 @@ BOOL update_write_fast_index_order(wStream* s, ORDER_INFO* orderInfo, FAST_INDEX
return TRUE;
}
BOOL update_read_fast_glyph_order(wStream* s, ORDER_INFO* orderInfo, FAST_GLYPH_ORDER* fast_glyph)
BOOL update_read_fast_glyph_order(wStream* s, ORDER_INFO* orderInfo, FAST_GLYPH_ORDER* fastGlyph)
{
BYTE* phold;
GLYPH_DATA_V2* glyph;
GLYPH_DATA_V2* glyph = &fastGlyph->glyphData;
ORDER_FIELD_BYTE(1, fast_glyph->cacheId);
ORDER_FIELD_2BYTE(2, fast_glyph->ulCharInc, fast_glyph->flAccel);
ORDER_FIELD_COLOR(3, fast_glyph->backColor);
ORDER_FIELD_COLOR(4, fast_glyph->foreColor);
ORDER_FIELD_COORD(5, fast_glyph->bkLeft);
ORDER_FIELD_COORD(6, fast_glyph->bkTop);
ORDER_FIELD_COORD(7, fast_glyph->bkRight);
ORDER_FIELD_COORD(8, fast_glyph->bkBottom);
ORDER_FIELD_COORD(9, fast_glyph->opLeft);
ORDER_FIELD_COORD(10, fast_glyph->opTop);
ORDER_FIELD_COORD(11, fast_glyph->opRight);
ORDER_FIELD_COORD(12, fast_glyph->opBottom);
ORDER_FIELD_COORD(13, fast_glyph->x);
ORDER_FIELD_COORD(14, fast_glyph->y);
ORDER_FIELD_BYTE(1, fastGlyph->cacheId);
ORDER_FIELD_2BYTE(2, fastGlyph->ulCharInc, fastGlyph->flAccel);
ORDER_FIELD_COLOR(3, fastGlyph->backColor);
ORDER_FIELD_COLOR(4, fastGlyph->foreColor);
ORDER_FIELD_COORD(5, fastGlyph->bkLeft);
ORDER_FIELD_COORD(6, fastGlyph->bkTop);
ORDER_FIELD_COORD(7, fastGlyph->bkRight);
ORDER_FIELD_COORD(8, fastGlyph->bkBottom);
ORDER_FIELD_COORD(9, fastGlyph->opLeft);
ORDER_FIELD_COORD(10, fastGlyph->opTop);
ORDER_FIELD_COORD(11, fastGlyph->opRight);
ORDER_FIELD_COORD(12, fastGlyph->opBottom);
ORDER_FIELD_COORD(13, fastGlyph->x);
ORDER_FIELD_COORD(14, fastGlyph->y);
if (orderInfo->fieldFlags & ORDER_FIELD_15)
{
if (Stream_GetRemainingLength(s) < 1)
return FALSE;
Stream_Read_UINT8(s, fast_glyph->cbData);
Stream_Read_UINT8(s, fastGlyph->cbData);
if (Stream_GetRemainingLength(s) < fast_glyph->cbData)
if (Stream_GetRemainingLength(s) < fastGlyph->cbData)
return FALSE;
CopyMemory(fast_glyph->data, Stream_Pointer(s), fast_glyph->cbData);
CopyMemory(fastGlyph->data, Stream_Pointer(s), fastGlyph->cbData);
phold = Stream_Pointer(s);
if (!Stream_SafeSeek(s, 1))
return FALSE;
if (fast_glyph->cbData > 1)
if (fastGlyph->cbData > 1)
{
/* parse optional glyph data */
glyph = &fast_glyph->glyphData;
glyph->cacheIndex = fast_glyph->data[0];
glyph->cacheIndex = fastGlyph->data[0];
if (!update_read_2byte_signed(s, &glyph->x) ||
!update_read_2byte_signed(s, &glyph->y) ||
@ -1677,17 +1676,14 @@ BOOL update_read_fast_glyph_order(wStream* s, ORDER_INFO* orderInfo, FAST_GLYPH_
if (Stream_GetRemainingLength(s) < glyph->cb)
return FALSE;
if (glyph->aj)
if (glyph->cb)
{
free(glyph->aj);
glyph->aj = NULL;
glyph->aj = (BYTE*) realloc(glyph->aj, glyph->cb);
Stream_Read(s, glyph->aj, glyph->cb);
}
glyph->aj = (BYTE*) malloc(glyph->cb);
Stream_Read(s, glyph->aj, glyph->cb);
}
Stream_Pointer(s) = phold + fast_glyph->cbData;
Stream_Pointer(s) = phold + fastGlyph->cbData;
}
return TRUE;

View File

@ -123,13 +123,16 @@ static int freerdp_peer_virtual_channel_write(freerdp_peer* client, HANDLE hChan
UINT32 chunkSize;
UINT32 maxChunkSize;
UINT32 totalLength;
rdpPeerChannel* peerChannel;
rdpMcsChannel* mcsChannel;
rdpRdp* rdp = client->context->rdp;
rdpPeerChannel* peerChannel = (rdpPeerChannel*) hChannel;
rdpMcsChannel* mcsChannel = peerChannel->mcsChannel;
if (!hChannel)
return -1;
peerChannel = (rdpPeerChannel*) hChannel;
mcsChannel = peerChannel->mcsChannel;
if (peerChannel->channelFlags & WTS_CHANNEL_OPTION_DYNAMIC)
return -1; /* not yet supported */

View File

@ -519,6 +519,17 @@ rdpSettings* freerdp_settings_clone(rdpSettings* settings)
_settings->LoadBalanceInfo = NULL;
_settings->LoadBalanceInfoLength = 0;
_settings->TargetNetAddress = NULL;
_settings->RedirectionTargetFQDN = NULL;
_settings->RedirectionTargetNetBiosName = NULL;
_settings->RedirectionUsername = NULL;
_settings->RedirectionDomain = NULL;
_settings->RedirectionPassword = NULL;
_settings->RedirectionPasswordLength = 0;
_settings->RedirectionTsvUrl = NULL;
_settings->RedirectionTsvUrlLength = 0;
_settings->TargetNetAddressCount = 0;
_settings->TargetNetAddresses = NULL;
if (settings->LoadBalanceInfo && settings->LoadBalanceInfoLength)
{

View File

@ -526,6 +526,12 @@ void update_reset_state(rdpUpdate* update)
rdpPrimaryUpdate* primary = update->primary;
rdpAltSecUpdate* altsec = update->altsec;
if (primary->fast_glyph.glyphData.aj)
{
free(primary->fast_glyph.glyphData.aj);
primary->fast_glyph.glyphData.aj = NULL;
}
ZeroMemory(&primary->order_info, sizeof(ORDER_INFO));
ZeroMemory(&primary->dstblt, sizeof(DSTBLT_ORDER));
ZeroMemory(&primary->patblt, sizeof(PATBLT_ORDER));
@ -1707,35 +1713,27 @@ rdpUpdate* update_new(rdpRdp* rdp)
const wObject cb = { NULL, NULL, NULL, update_free_queued_message, NULL };
rdpUpdate* update;
update = (rdpUpdate*) malloc(sizeof(rdpUpdate));
update = (rdpUpdate*) calloc(1, sizeof(rdpUpdate));
if (update)
{
OFFSCREEN_DELETE_LIST* deleteList;
ZeroMemory(update, sizeof(rdpUpdate));
WLog_Init();
update->log = WLog_Get("com.freerdp.core.update");
update->bitmap_update.count = 64;
update->bitmap_update.rectangles = (BITMAP_DATA*) malloc(sizeof(BITMAP_DATA) * update->bitmap_update.count);
ZeroMemory(update->bitmap_update.rectangles, sizeof(BITMAP_DATA) * update->bitmap_update.count);
update->bitmap_update.rectangles = (BITMAP_DATA*) calloc(update->bitmap_update.count, sizeof(BITMAP_DATA));
update->pointer = (rdpPointerUpdate*) malloc(sizeof(rdpPointerUpdate));
ZeroMemory(update->pointer, sizeof(rdpPointerUpdate));
update->pointer = (rdpPointerUpdate*) calloc(1, sizeof(rdpPointerUpdate));
update->primary = (rdpPrimaryUpdate*) malloc(sizeof(rdpPrimaryUpdate));
ZeroMemory(update->primary, sizeof(rdpPrimaryUpdate));
update->primary = (rdpPrimaryUpdate*) calloc(1, sizeof(rdpPrimaryUpdate));
update->secondary = (rdpSecondaryUpdate*) malloc(sizeof(rdpSecondaryUpdate));
ZeroMemory(update->secondary, sizeof(rdpSecondaryUpdate));
update->secondary = (rdpSecondaryUpdate*) calloc(1, sizeof(rdpSecondaryUpdate));
update->altsec = (rdpAltSecUpdate*) malloc(sizeof(rdpAltSecUpdate));
ZeroMemory(update->altsec, sizeof(rdpAltSecUpdate));
update->altsec = (rdpAltSecUpdate*) calloc(1, sizeof(rdpAltSecUpdate));
update->window = (rdpWindowUpdate*) malloc(sizeof(rdpWindowUpdate));
ZeroMemory(update->window, sizeof(rdpWindowUpdate));
update->window = (rdpWindowUpdate*) calloc(1, sizeof(rdpWindowUpdate));
deleteList = &(update->altsec->create_offscreen_bitmap.deleteList);
deleteList->sIndices = 64;

View File

@ -67,6 +67,12 @@ void shadow_client_context_new(freerdp_peer* peer, rdpShadowClient* client)
settings->RdpKeyFile = _strdup(settings->PrivateKeyFile);
if (server->ipcSocket)
{
settings->LyncRdpMode = TRUE;
settings->CompressionEnabled = FALSE;
}
client->inLobby = TRUE;
client->mayView = server->mayView;
client->mayInteract = server->mayInteract;
@ -839,12 +845,15 @@ int shadow_client_subsystem_process_message(rdpShadowClient* client, wMessage* m
pointerPosition.xPos = msg->xPos;
pointerPosition.yPos = msg->yPos;
if ((msg->xPos != client->pointerX) || (msg->yPos != client->pointerY))
if (client->activated)
{
IFCALL(update->pointer->PointerPosition, context, &pointerPosition);
if ((msg->xPos != client->pointerX) || (msg->yPos != client->pointerY))
{
IFCALL(update->pointer->PointerPosition, context, &pointerPosition);
client->pointerX = msg->xPos;
client->pointerY = msg->yPos;
client->pointerX = msg->xPos;
client->pointerY = msg->yPos;
}
}
free(msg);
@ -869,14 +878,17 @@ int shadow_client_subsystem_process_message(rdpShadowClient* client, wMessage* m
pointerCached.cacheIndex = pointerColor->cacheIndex;
shadow_client_convert_alpha_pointer_data(msg->pixels, msg->premultiplied,
msg->width, msg->height, pointerColor);
if (client->activated)
{
shadow_client_convert_alpha_pointer_data(msg->pixels, msg->premultiplied,
msg->width, msg->height, pointerColor);
IFCALL(update->pointer->PointerNew, context, &pointerNew);
IFCALL(update->pointer->PointerCached, context, &pointerCached);
IFCALL(update->pointer->PointerNew, context, &pointerNew);
IFCALL(update->pointer->PointerCached, context, &pointerCached);
free(pointerColor->xorMaskData);
free(pointerColor->andMaskData);
free(pointerColor->xorMaskData);
free(pointerColor->andMaskData);
}
free(msg->pixels);
free(msg);

View File

@ -148,7 +148,7 @@ void ClipboardUnlock(wClipboard* clipboard)
BOOL ClipboardEmpty(wClipboard* clipboard)
{
if (!clipboard)
return NULL;
return FALSE;
if (clipboard->data)
{
@ -540,6 +540,10 @@ void ClipboardDestroy(wClipboard* clipboard)
}
}
free((void*) clipboard->data);
clipboard->data = NULL;
clipboard->size = 0;
clipboard->numFormats = 0;
free(clipboard->formats);

View File

@ -137,7 +137,7 @@ static void* clipboard_synthesize_cf_unicodetext(wClipboard* clipboard, UINT32 f
if (status <= 0)
return NULL;
*pSize = ((status + 1) * 2);
*pSize = status * 2;
}
return (void*) pDstData;

View File

@ -296,11 +296,9 @@ static void winpr_StartThread(WINPR_THREAD *thread)
HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId)
{
#ifndef HAVE_EVENTFD_H
int flags;
#endif
HANDLE handle;
WINPR_THREAD* thread;
thread = (WINPR_THREAD*) calloc(1, sizeof(WINPR_THREAD));
if (!thread)
@ -334,8 +332,10 @@ HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize
return NULL;
}
flags = fcntl(thread->pipe_fd[0], F_GETFL);
fcntl(thread->pipe_fd[0], F_SETFL, flags | O_NONBLOCK);
{
int flags = fcntl(thread->pipe_fd[0], F_GETFL);
fcntl(thread->pipe_fd[0], F_SETFL, flags | O_NONBLOCK);
}
#endif
pthread_mutex_init(&thread->mutex, 0);