JBR-8278: fixed performOnMainThreadWaiting run block condition to fix FullscreenWindowProps and NoResizeEventOnDMChangeTest tests

This commit is contained in:
bourgesl
2025-04-16 12:40:11 +02:00
parent d08c6eb496
commit 8c3a5c3252

View File

@@ -37,9 +37,6 @@
return; \
}
#define RUN_BLOCK_IF_MAIN(block) \
RUN_BLOCK_IF([NSThread isMainThread], block)
/* Returns the MainThread latency threshold in milliseconds
* used to detect slow operations that may cause high latencies or delays.
* If negative, the MainThread monitor is disabled */
@@ -331,7 +328,7 @@ AWT_ASSERT_APPKIT_THREAD;
+ (void)performOnMainThreadNowOrLater:(BOOL)useJavaModes
block:(void (^)())block
{
RUN_BLOCK_IF_MAIN(block);
RUN_BLOCK_IF([NSThread isMainThread], block);
[ThreadUtilities performOnMainThread:@selector(invokeBlockCopy:) on:self withObject:Block_copy(block)
waitUntilDone:NO useJavaModes:useJavaModes];
@@ -353,7 +350,7 @@ AWT_ASSERT_APPKIT_THREAD;
useJavaModes:(BOOL)useJavaModes
block:(void (^)())block
{
RUN_BLOCK_IF_MAIN(block);
RUN_BLOCK_IF([NSThread isMainThread] && wait, block);
[ThreadUtilities performOnMainThread:@selector(invokeBlockCopy:) on:self withObject:Block_copy(block)
waitUntilDone:wait useJavaModes:useJavaModes];
@@ -434,7 +431,7 @@ AWT_ASSERT_APPKIT_THREAD;
waitUntilDone:(BOOL)wait
useJavaModes:(BOOL)useJavaModes
{
const BOOL invokeDirect = NSThread.isMainThread && wait;
const BOOL invokeDirect = [NSThread isMainThread] && wait;
const BOOL doWait = !invokeDirect && wait;
const BOOL blockingEDT = doWait && isEventDispatchThread();