Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2014-05-28 07:46:07 +0000
committerArun Thondapu2014-08-27 10:57:03 +0000
commitd13ccd6ef4a4095ac499546efd950f93f593394c (patch)
tree3bcc81c2e2b51078abb436946615720507c0ca4c
parenta02cd0ca0e3604da5a3379d15d27c5bece9684f7 (diff)
downloadeclipse.platform.swt-d13ccd6ef4a4095ac499546efd950f93f593394c.tar.gz
eclipse.platform.swt-d13ccd6ef4a4095ac499546efd950f93f593394c.tar.xz
eclipse.platform.swt-d13ccd6ef4a4095ac499546efd950f93f593394c.zip
Bug 241957 - Hang in org.eclipse.swt.internal.gtk.OS._gtk_clipboard_wait_for_contents
Limit wait time to GTK built-in 30 second timeout. Change-Id: Ida36ead3663a43c41b69e65eb1461bd9059ff8a2 Signed-off-by: Anton Leherbauer <anton.leherbauer@windriver.com> (cherry picked from commit 60ff4c61f9b274f470c47d2955baafd01620b5ee)
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
index 0cf7d4f230..4e5a2cca1e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -671,11 +671,19 @@ private int[] getAvailableClipboardTypes () {
}
long /*int*/ gtk_clipboard_wait_for_contents(long /*int*/ clipboard, long /*int*/ target) {
+ long startTime = System.currentTimeMillis();
String key = "org.eclipse.swt.internal.gtk.dispatchEvent";
Display display = this.display;
display.setData(key, new int[]{OS.GDK_PROPERTY_NOTIFY, OS.GDK_SELECTION_CLEAR, OS.GDK_SELECTION_REQUEST, OS.GDK_SELECTION_NOTIFY});
long /*int*/ selection_data = OS.gtk_clipboard_wait_for_contents(clipboard, target);
display.setData(key, null);
+ long duration = System.currentTimeMillis() - startTime;
+ if (selection_data == 0 && duration > 5000) {
+ // Bug 241957: In case of timeout take clipboard ownership to unblock future calls
+ ClipboardProxy._getInstance(display).setData(this, new String[] {" "},
+ new Transfer[] { TextTransfer.getInstance() },
+ clipboard == GTKCLIPBOARD ? DND.CLIPBOARD : DND.SELECTION_CLIPBOARD);
+ }
return selection_data;
}
}

Back to the top