From 262fcc2af1de50f536f3c84d453f94d003f124bf Mon Sep 17 00:00:00 2001 From: bumfo Date: Mon, 11 May 2026 17:16:34 +0800 Subject: [PATCH] macOS: reset fDisplayLinkRunning when releasing CVDisplayLink on hide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setVisible(false) releases the CVDisplayLink and zeroes fDisplayLink, but doesn't clear fDisplayLinkRunning. After the next setVisible(true) creates a fresh link, requestFrame() finds the stale flag still set and skips CVDisplayLinkStart — the new link is never started, no displayLinkCallback fires, no EventFrame is dispatched, and the window appears frozen (no paint, no animation) until the user toggles visibility again. The reset was unnecessary before 5cdda76 ("macOS: Do not stop cvdisplaylink", 0.4.18) because displayLinkCallback used to clear the flag whenever it observed a quiet tick. That callback path is commented out now, so setVisible(false) is the only place left to clear it. Co-Authored-By: Claude Opus 4.7 (1M context) --- macos/cc/WindowMac.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/macos/cc/WindowMac.mm b/macos/cc/WindowMac.mm index bfb08a25..6dcb04d1 100644 --- a/macos/cc/WindowMac.mm +++ b/macos/cc/WindowMac.mm @@ -134,6 +134,7 @@ static CVReturn displayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt CVDisplayLinkStop(fDisplayLink); CVDisplayLinkRelease(fDisplayLink); fDisplayLink = 0; + fDisplayLinkRunning = false; unref(); } fVisible = value;