diff --git a/imgui.cpp b/imgui.cpp index 8db2b250c..9d3cb1ba7 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -9655,7 +9655,10 @@ static const char* GetClipboardTextFn_DefaultImpl(void*) return NULL; HANDLE wbuf_handle = GetClipboardData(CF_UNICODETEXT); if (wbuf_handle == NULL) + { + CloseClipboard(); return NULL; + } if (ImWchar* wbuf_global = (ImWchar*)GlobalLock(wbuf_handle)) { int buf_len = ImTextCountUtf8BytesFromStr(wbuf_global, NULL) + 1;