Clipboard: [windows] Fixed not closing win32 clipboard on early return. (#1264)

This commit is contained in:
omar 2017-08-05 16:05:48 +08:00
parent 40ac84d701
commit 95f2706d1c

View File

@ -9655,7 +9655,10 @@ static const char* GetClipboardTextFn_DefaultImpl(void*)
return NULL; return NULL;
HANDLE wbuf_handle = GetClipboardData(CF_UNICODETEXT); HANDLE wbuf_handle = GetClipboardData(CF_UNICODETEXT);
if (wbuf_handle == NULL) if (wbuf_handle == NULL)
{
CloseClipboard();
return NULL; return NULL;
}
if (ImWchar* wbuf_global = (ImWchar*)GlobalLock(wbuf_handle)) if (ImWchar* wbuf_global = (ImWchar*)GlobalLock(wbuf_handle))
{ {
int buf_len = ImTextCountUtf8BytesFromStr(wbuf_global, NULL) + 1; int buf_len = ImTextCountUtf8BytesFromStr(wbuf_global, NULL) + 1;