mfreerdp: fix possible crash on gdi termination

This commit is contained in:
Marc-André Moreau 2013-11-25 00:25:16 -05:00
parent 8fa7008435
commit 128fb72ec6
4 changed files with 12 additions and 8 deletions

View File

@ -395,7 +395,7 @@ void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, wStream* s, UI
if ((msgFlags & CB_RESPONSE_FAIL) != 0)
{
/* In case of an error the clipboard will not be synchronized with the server.
* Post this event to restart format negociation and data transfer. */
* Post this event to restart format negotiation and data transfer. */
wMessage* event = freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_MonitorReady, NULL, NULL);
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, event);

View File

@ -435,6 +435,7 @@ int cliprdr_client_format_data_request(CliprdrClientContext* context, CLIPRDR_FO
cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle;
formatDataRequest->msgType = CB_FORMAT_DATA_REQUEST;
formatDataRequest->msgFlags = 0;
formatDataRequest->dataLen = 4;
s = cliprdr_packet_new(formatDataRequest->msgType, formatDataRequest->msgFlags, formatDataRequest->dataLen);

View File

@ -1051,6 +1051,10 @@ void mac_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmap)
void mac_begin_paint(rdpContext* context)
{
rdpGdi* gdi = context->gdi;
if (!gdi)
return;
gdi->primary->hdc->hwnd->invalid->null = 1;
}
@ -1063,11 +1067,15 @@ void mac_end_paint(rdpContext* context)
int i;
rdpGdi* gdi;
NSRect drawRect;
int ww, wh, dw, dh;
mfContext* mfc = (mfContext*) context;
MRDPView* view = (MRDPView*) mfc->view;
int ww, wh, dw, dh;
gdi = context->gdi;
if (!gdi)
return;
ww = mfc->client_width;
wh = mfc->client_height;
dw = mfc->context.settings->DesktopWidth;
@ -1081,8 +1089,6 @@ void mac_end_paint(rdpContext* context)
if (context->gdi->drawing != context->gdi->primary)
return;
gdi = context->gdi;
for (i = 0; i < gdi->primary->hdc->hwnd->ninvalid; i++)
{

View File

@ -40,7 +40,6 @@
#include <freerdp/event.h>
#include <freerdp/locale/keyboard.h>
#include <freerdp/version.h>
#include <freerdp/gdi/gdi.h>
/* connectErrorCode is 'extern' in error.h. See comment there.*/
@ -448,8 +447,6 @@ void freerdp_context_free(freerdp* instance)
graphics_free(instance->context->graphics);
instance->context->graphics = NULL;
gdi_free(instance);
PubSub_Free(instance->context->pubSub);
free(instance->context);