OS2_HasClipboardText: store the boolean result before closing clipboard.

just in case..
This commit is contained in:
Ozkan Sezer 2022-02-04 23:28:56 +03:00
parent b5614d0c6e
commit c8cee0b8ca
1 changed files with 3 additions and 1 deletions

View File

@ -1402,6 +1402,7 @@ static SDL_bool OS2_HasClipboardText(_THIS)
{ {
SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata;
PSZ pszClipboard; PSZ pszClipboard;
SDL_bool result;
if (!WinOpenClipbrd(pVData->hab)) { if (!WinOpenClipbrd(pVData->hab)) {
debug_os2("WinOpenClipbrd() failed"); debug_os2("WinOpenClipbrd() failed");
@ -1409,9 +1410,10 @@ static SDL_bool OS2_HasClipboardText(_THIS)
} }
pszClipboard = (PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT); pszClipboard = (PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT);
result = (pszClipboard && *pszClipboard) ? SDL_TRUE : SDL_FALSE;
WinCloseClipbrd(pVData->hab); WinCloseClipbrd(pVData->hab);
return (pszClipboard && *pszClipboard) ? SDL_TRUE : SDL_FALSE; return result;
} }