Skip to content

Commit 26f091f

Browse files
committed
Close clipboard even if emptying fails.
1 parent d777a9a commit 26f091f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

wincon/pdcclip.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,15 @@ int PDC_freeclipboard(char *contents)
142142

143143
int PDC_clearclipboard(void)
144144
{
145+
BOOL result = FALSE;
146+
145147
PDC_LOG(("PDC_clearclipboard() - called\n"));
146148

147149
if (OpenClipboard(NULL))
148-
if (EmptyClipboard())
149-
{
150-
CloseClipboard();
151-
return PDC_CLIP_SUCCESS;
152-
}
150+
{
151+
result = EmptyClipboard();
152+
CloseClipboard();
153+
}
153154

154-
return PDC_CLIP_ACCESS_ERROR;
155+
return result ? PDC_CLIP_SUCCESS : PDC_CLIP_ACCESS_ERROR;
155156
}

0 commit comments

Comments
 (0)