diff options
| author | Jason Rumney | 2004-04-18 18:34:03 +0000 |
|---|---|---|
| committer | Jason Rumney | 2004-04-18 18:34:03 +0000 |
| commit | 6383ca22fcf6d37fffdd4fe729a937409c70801b (patch) | |
| tree | d38938449e05ac65a4b6b0b6bf7bddf65b9598f4 | |
| parent | b7e85537d88afdbac6544cfa187737d9922240c5 (diff) | |
| download | emacs-6383ca22fcf6d37fffdd4fe729a937409c70801b.tar.gz emacs-6383ca22fcf6d37fffdd4fe729a937409c70801b.zip | |
(Fw32_set_clipboard_data): Get sequence number after closing the clipboard.
| -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: |