Commit 9b84bb66 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

GetClipboardData16 might return an invalid global handle (spotted by

Corel).
parent 09f8a751
...@@ -1057,16 +1057,13 @@ static Atom EVENT_SelectionRequest_STRING( Window requestor, Atom target, Atom r ...@@ -1057,16 +1057,13 @@ static Atom EVENT_SelectionRequest_STRING( Window requestor, Atom target, Atom r
itemFmtName, CF_TEXT, CLIPBOARD_GetFormatName(CF_TEXT)); itemFmtName, CF_TEXT, CLIPBOARD_GetFormatName(CF_TEXT));
TSXFree(itemFmtName); TSXFree(itemFmtName);
if ( !CLIPBOARD_IsPresent(CF_TEXT) )
{
rprop = None;
goto END;
}
hText = GetClipboardData16(CF_TEXT); hText = GetClipboardData16(CF_TEXT);
if ( !hText )
return None;
text = GlobalLock16(hText); text = GlobalLock16(hText);
if (!text)
return None;
size = GlobalSize16(hText); size = GlobalSize16(hText);
/* remove carriage returns */ /* remove carriage returns */
lpstr = (char*)HEAP_xalloc( GetProcessHeap(), 0, size-- ); lpstr = (char*)HEAP_xalloc( GetProcessHeap(), 0, size-- );
...@@ -1088,7 +1085,6 @@ static Atom EVENT_SelectionRequest_STRING( Window requestor, Atom target, Atom r ...@@ -1088,7 +1085,6 @@ static Atom EVENT_SelectionRequest_STRING( Window requestor, Atom target, Atom r
GlobalUnlock16(hText); GlobalUnlock16(hText);
HeapFree( GetProcessHeap(), 0, lpstr ); HeapFree( GetProcessHeap(), 0, lpstr );
END:
return rprop; return rprop;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment