diff --git a/filament/backend/src/opengl/PlatformCocoaGL.mm b/filament/backend/src/opengl/PlatformCocoaGL.mm index 42fb85da76..e93308e2fd 100644 --- a/filament/backend/src/opengl/PlatformCocoaGL.mm +++ b/filament/backend/src/opengl/PlatformCocoaGL.mm @@ -147,13 +147,7 @@ bool PlatformCocoaGL::pumpEvents() noexcept { if (![NSThread isMainThread]) { return false; } - while (true) { - NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES]; - if (event == nil) { - break; - } - [NSApp sendEvent:event]; - } + [[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantPast]]; return true; } diff --git a/filament/src/Fence.cpp b/filament/src/Fence.cpp index 93a6ebdaa1..4c2f41fb48 100644 --- a/filament/src/Fence.cpp +++ b/filament/src/Fence.cpp @@ -99,7 +99,7 @@ FenceStatus FFence::wait(Mode mode, uint64_t timeout) noexcept { } engine.pumpPlatformEvents(); const auto elapsed = std::chrono::system_clock::now() - startTime; - if (elapsed >= ns(timeout)) { + if (timeout != Fence::FENCE_WAIT_FOR_EVER && elapsed >= ns(timeout)) { break; } }