diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
index f82d16d6f84..c36471d39a5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
@@ -494,7 +494,12 @@ Point computeNativeSize (long h, int wHint, int hHint, boolean changed) {
*
* The current selection is copied to the clipboard.
*
- *
+ *
+ * Note: Copy data to the Clipboard may be asynchronous. This
+ * means that the new clipboard content may not be immediately available right
+ * after calling this method. To ensure the update is visible, use
+ * {@link Display#asyncExec(Runnable)} before accessing the clipboard data.
+ *
* @exception SWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -1955,7 +1960,12 @@ long paintSurface () {
* The selected text is deleted from the widget
* and new text inserted from the clipboard.
*
- *
+ *
+ * Note: Pasting data to controls may occurs asynchronously. The widget
+ * text may not reflect the updated value immediately after calling this method.
+ * The new text will appear once pending events are processed in the event loop.
+ * Use {@link Display#asyncExec(Runnable)} before accessing getText()
.
+ *
* @exception SWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java
index f40ab7f586a..3bd89e28e20 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java
@@ -34,6 +34,7 @@
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Display;
import org.junit.Before;
import org.junit.Test;
@@ -236,6 +237,11 @@ public void test_copy() {
combo.copy();
combo.setSelection(new Point(0,0));
combo.paste();
+ // Spin the event loop to let GTK process the clipboard + entry update
+ Display display = combo.getDisplay();
+ while (display.readAndDispatch()) {
+ // loop until no more events
+ }
assertEquals("23123456", combo.getText());
}
@@ -501,6 +507,11 @@ public void test_paste() {
combo.cut();
assertEquals("1456", combo.getText());
combo.paste();
+ // Spin the event loop to let GTK process the clipboard + entry update
+ Display display = combo.getDisplay();
+ while (display.readAndDispatch()) {
+ // loop until no more events
+ }
assertEquals("123456", combo.getText());
}