diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32select.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/w32select.c b/src/w32select.c index 940cce35772..0c8849c7be6 100644 --- a/src/w32select.c +++ b/src/w32select.c | |||
| @@ -259,11 +259,18 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, | |||
| 259 | 259 | ||
| 260 | ok = EmptyClipboard () && SetClipboardData (CF_TEXT, htext); | 260 | ok = EmptyClipboard () && SetClipboardData (CF_TEXT, htext); |
| 261 | 261 | ||
| 262 | CloseClipboard (); | ||
| 263 | |||
| 264 | /* Common sense says to read the sequence number inside the | ||
| 265 | OpenClipboard/ CloseClipboard block to avoid race conditions | ||
| 266 | where another app puts something on the clipboard straight after | ||
| 267 | us. But experience suggests that the sequence number from the | ||
| 268 | SetClipboardData is not allocated until we close the clipboard! | ||
| 269 | Since clipboard operations are normally user-driven, the race | ||
| 270 | condition is probably not going to really happen. */ | ||
| 262 | if (clipboard_sequence_fn) | 271 | if (clipboard_sequence_fn) |
| 263 | last_clipboard_sequence_number = clipboard_sequence_fn (); | 272 | last_clipboard_sequence_number = clipboard_sequence_fn (); |
| 264 | 273 | ||
| 265 | CloseClipboard (); | ||
| 266 | |||
| 267 | if (ok) goto done; | 274 | if (ok) goto done; |
| 268 | 275 | ||
| 269 | error: | 276 | error: |