summaryrefslogtreecommitdiff
path: root/src/w32select.c
diff options
context:
space:
mode:
authorJason Rumney <jasonr@gnu.org>2004-04-18 18:34:03 +0000
committerJason Rumney <jasonr@gnu.org>2004-04-18 18:34:03 +0000
commit6383ca22fcf6d37fffdd4fe729a937409c70801b (patch)
treed38938449e05ac65a4b6b0b6bf7bddf65b9598f4 /src/w32select.c
parentb7e85537d88afdbac6544cfa187737d9922240c5 (diff)
downloademacs-6383ca22fcf6d37fffdd4fe729a937409c70801b.tar.gz
(Fw32_set_clipboard_data): Get sequence number after closing the clipboard.
Diffstat (limited to 'src/w32select.c')
-rw-r--r--src/w32select.c11
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,
ok = EmptyClipboard () && SetClipboardData (CF_TEXT, htext);
+ CloseClipboard ();
+
+ /* Common sense says to read the sequence number inside the
+ OpenClipboard/ CloseClipboard block to avoid race conditions
+ where another app puts something on the clipboard straight after
+ us. But experience suggests that the sequence number from the
+ SetClipboardData is not allocated until we close the clipboard!
+ Since clipboard operations are normally user-driven, the race
+ condition is probably not going to really happen. */
if (clipboard_sequence_fn)
last_clipboard_sequence_number = clipboard_sequence_fn ();
- CloseClipboard ();
-
if (ok) goto done;
error: