Skip to content

Apple: keep CocoaWindow main-queue updates valid after destruction - #111

Closed
navjack wants to merge 1 commit into
renderbag:mainfrom
navjack:apple-cocoawindow-main-queue
Closed

navjack wants to merge 1 commit into
renderbag:mainfrom
navjack:apple-cocoawindow-main-queue

Conversation

@navjack

@navjack navjack commented Sep 15, 2026

Copy link
Copy Markdown

Blocks queued to the main queue captured this, so a swapchain destroyed
before an asynchronous size or refresh-rate update ran left the block reading
freed memory (objc_msgSend crash in updateWindowAttributesInternal). Keep the
cached state in a shared_ptr and capture it with the NSWindow instead.

Testing

  • Developed and used in the macOS Metal port of LostOdysseyRecomp (Apple M4 Pro, macOS 27, Xcode 27), exercising this path during gameplay.
  • This branch is the single commit cherry-picked onto current main; -fsyntax-only compile of the changed sources on arm64 macOS against main passes.

🤖 Generated with Claude Code

Blocks queued to the main queue captured `this`, so a swapchain destroyed
before an asynchronous size or refresh-rate update ran left the block reading
freed memory (objc_msgSend crash in updateWindowAttributesInternal). Keep the
cached state in a shared_ptr and capture it with the NSWindow instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@DarioSamo

Copy link
Copy Markdown
Contributor

AI-generated contributions are not accepted, especially ones with Claude as the co-author. No copyright will be given to Anthropic in any of my projects.

@DarioSamo DarioSamo closed this Sep 15, 2026
@renderbag renderbag locked and limited conversation to collaborators Sep 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants