Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -551,14 +551,16 @@ private static void processOSMessagesUntil(Supplier<Boolean> condition, Consumer
MSG msg = new MSG();
AtomicBoolean timeoutOccurred = new AtomicBoolean();
// The timer call also wakes up the display to avoid being stuck in display.sleep()
display.timerExec((int) MAXIMUM_OPERATION_TIME.toMillis(), () -> timeoutOccurred.set(true));
Runnable runnable = () -> timeoutOccurred.set(true);
display.timerExec((int) MAXIMUM_OPERATION_TIME.toMillis(), runnable);
while (!display.isDisposed() && !condition.get() && !timeoutOccurred.get()) {
if (OS.PeekMessage(msg, 0, 0, 0, OS.PM_NOREMOVE | OS.PM_QS_POSTMESSAGE)) {
display.readAndDispatch();
} else {
display.sleep();
}
}
display.timerExec(-1, runnable);
if (!condition.get()) {
timeoutHandler.accept(createTimeOutException());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
Expand Down Expand Up @@ -2754,6 +2755,18 @@ public void test_TabTraversalOutOfBrowser() {
assertTrue(text.isFocusControl());
}

// Regression test for https://github.com/eclipse-platform/eclipse.platform.swt/issues/2806
@Test
public void test_TimerRegression_Issue2806() {
for (int i = 0; i < 10000; i++) {
browser.setText("Iteration " + i);
new BrowserFunction(browser, "name");
}
new Composite(shell, SWT.NONE);
processUiEvents();

}

/* custom */
/**
* Wait for passTest to return true. Timeout otherwise.
Expand Down
Loading