macOS: reset fDisplayLinkRunning when releasing CVDisplayLink on hide#305
Open
bumfo wants to merge 1 commit into
Open
macOS: reset fDisplayLinkRunning when releasing CVDisplayLink on hide#305bumfo wants to merge 1 commit into
bumfo wants to merge 1 commit into
Conversation
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) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
On macOS, after
Window.setVisible(false)→Window.setVisible(true), the window appears frozen — no paint, no animation, noEventFrameever fires.requestFrame()is a no-op until the window is toggled once more.Root cause
WindowMac::setVisible(false)releases theCVDisplayLinkand zeroesfDisplayLink, but doesn't clearfDisplayLinkRunning. The nextsetVisible(true)creates a fresh link, butrequestFrame()checksif (fVisible && !fDisplayLinkRunning)— the staletrueshort-circuits theCVDisplayLinkStartcall, so the new link is never started.Regression history
The reset was unnecessary before 5cdda76 (
macOS: Do not stop cvdisplaylink, 0.4.18) becausedisplayLinkCallbackused to clear the flag itself whenever a tick fired with no pending frame. That cleanup is commented out now, sosetVisible(false)is the only remaining place to clear it. Affected versions: 0.4.18 through 0.4.24.Repro
Fix
Set
fDisplayLinkRunning = falsealongsidefDisplayLink = 0when releasing the link insetVisible(false). One line.