aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32select.c
diff options
context:
space:
mode:
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 21f828d1f0c..cc0ca64fab8 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -249,11 +249,18 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
249 249
250 ok = EmptyClipboard () && SetClipboardData (CF_TEXT, htext); 250 ok = EmptyClipboard () && SetClipboardData (CF_TEXT, htext);
251 251
252 CloseClipboard ();
253
254 /* Common sense says to read the sequence number inside the
255 OpenClipboard/ CloseClipboard block to avoid race conditions
256 where another app puts something on the clipboard straight after
257 us. But experience suggests that the sequence number from the
258 SetClipboardData is not allocated until we close the clipboard!
259 Since clipboard operations are normally user-driven, the race
260 condition is probably not going to really happen. */
252 if (clipboard_sequence_fn) 261 if (clipboard_sequence_fn)
253 last_clipboard_sequence_number = clipboard_sequence_fn (); 262 last_clipboard_sequence_number = clipboard_sequence_fn ();
254 263
255 CloseClipboard ();
256
257 if (ok) goto done; 264 if (ok) goto done;
258 265
259 error: 266 error: