Skip to content

Commit 37b2026

Browse files
committed
throw no more handles if a timer could not be created
At the moment the code silently fails on calling timerExec if there are no handles left or it fails for other reasons. Relates to #2806 where we can see that we are running out of handles, but the timerExec does not report a failure.
1 parent 28bb9b4 commit 37b2026

File tree

1 file changed

+4
-4
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets

1 file changed

+4
-4
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4964,6 +4964,7 @@ public <T, E extends Exception> T syncCall(SwtCallable<T, E> callable) throws E
49644964
* @exception SWTException <ul>
49654965
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
49664966
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
4967+
* <li>ERROR_NO_HANDLES if a handle could not be obtained for timer creation</li>
49674968
* </ul>
49684969
*
49694970
* @see #asyncExec
@@ -5005,10 +5006,9 @@ public void timerExec (int milliseconds, Runnable runnable) {
50055006
}
50065007
}
50075008
long newTimerID = OS.SetTimer (hwndMessage, timerId, milliseconds, 0);
5008-
if (newTimerID != 0) {
5009-
timerList [index] = runnable;
5010-
timerIds [index] = newTimerID;
5011-
}
5009+
if (newTimerID == 0) SWT.error (SWT.ERROR_NO_HANDLES);
5010+
timerList [index] = runnable;
5011+
timerIds [index] = newTimerID;
50125012
}
50135013

50145014
boolean translateAccelerator (MSG msg, Control control) {

0 commit comments

Comments
 (0)