summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/tkWinClipboard.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c
index 03c0cde..877eed4 100644
--- a/win/tkWinClipboard.c
+++ b/win/tkWinClipboard.c
@@ -55,9 +55,14 @@ TkSelGetSelection(
Tcl_Encoding encoding;
int result, locale, noBackslash = 0;
+ if (!OpenClipboard(NULL)) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "clipboard cannot be opened, another application grabbed it"));
+ Tcl_SetErrorCode(interp, "TK", "CLIPBOARD", "BUSY", NULL);
+ return TCL_ERROR;
+ }
if ((selection != Tk_InternAtom(tkwin, "CLIPBOARD"))
- || (target != XA_STRING)
- || !OpenClipboard(NULL)) {
+ || (target != XA_STRING)) {
goto error;
}