Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2014-05-28 07:46:07 +0000
committerArun Thondapu2014-08-27 10:32:26 +0000
commit60ff4c61f9b274f470c47d2955baafd01620b5ee (patch)
treeb1182b649fec181d00899c9cb2e2d5576da2718a
parent41e8931d8059d992463eeb155adabeac9625431b (diff)
downloadeclipse.platform.swt-60ff4c61f9b274f470c47d2955baafd01620b5ee.tar.gz
eclipse.platform.swt-60ff4c61f9b274f470c47d2955baafd01620b5ee.tar.xz
eclipse.platform.swt-60ff4c61f9b274f470c47d2955baafd01620b5ee.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>
-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