mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-26 17:00:06 +01:00
hw/xwin: Ensure we own the clipboard before checking the format of it's contents
Ensure we own the clipboard before checking the format of it's contents, this prevents the contents from changing underneath us. Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
parent
a4f357c620
commit
3ab95a2a5c
1 changed files with 18 additions and 18 deletions
|
|
@ -165,6 +165,24 @@ winClipboardFlushXEvents(HWND hwnd,
|
|||
break;
|
||||
}
|
||||
|
||||
/* Close clipboard if we have it open already */
|
||||
if (GetOpenClipboardWindow() == hwnd) {
|
||||
CloseClipboard();
|
||||
}
|
||||
|
||||
/* Access the clipboard */
|
||||
if (!OpenClipboard(hwnd)) {
|
||||
ErrorF("winClipboardFlushXEvents - SelectionRequest - "
|
||||
"OpenClipboard () failed: %08lx\n", GetLastError());
|
||||
|
||||
/* Abort */
|
||||
fAbort = TRUE;
|
||||
goto winClipboardFlushXEvents_SelectionRequest_Done;
|
||||
}
|
||||
|
||||
/* Indicate that clipboard was opened */
|
||||
fCloseClipboard = TRUE;
|
||||
|
||||
/* Check that clipboard format is available */
|
||||
if (fUseUnicode && !IsClipboardFormatAvailable(CF_UNICODETEXT)) {
|
||||
static int count; /* Hack to stop acroread spamming the log */
|
||||
|
|
@ -192,24 +210,6 @@ winClipboardFlushXEvents(HWND hwnd,
|
|||
goto winClipboardFlushXEvents_SelectionRequest_Done;
|
||||
}
|
||||
|
||||
/* Close clipboard if we have it open already */
|
||||
if (GetOpenClipboardWindow() == hwnd) {
|
||||
CloseClipboard();
|
||||
}
|
||||
|
||||
/* Access the clipboard */
|
||||
if (!OpenClipboard(hwnd)) {
|
||||
ErrorF("winClipboardFlushXEvents - SelectionRequest - "
|
||||
"OpenClipboard () failed: %08lx\n", GetLastError());
|
||||
|
||||
/* Abort */
|
||||
fAbort = TRUE;
|
||||
goto winClipboardFlushXEvents_SelectionRequest_Done;
|
||||
}
|
||||
|
||||
/* Indicate that clipboard was opened */
|
||||
fCloseClipboard = TRUE;
|
||||
|
||||
/* Setup the string style */
|
||||
if (event.xselectionrequest.target == XA_STRING)
|
||||
xiccesStyle = XStringStyle;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue