Skip to content

Fix frame capture callback lifetime#12

Draft
sjchmiela wants to merge 3 commits into
stanley/expo-serve-sim-03-vendor-livekit-webrtcfrom
stanley/expo-serve-sim-fix-frame-capture-callback-lifetime
Draft

Fix frame capture callback lifetime#12
sjchmiela wants to merge 3 commits into
stanley/expo-serve-sim-03-vendor-livekit-webrtcfrom
stanley/expo-serve-sim-fix-frame-capture-callback-lifetime

Conversation

@sjchmiela

Copy link
Copy Markdown
Collaborator

Summary

  • retain SimulatorKit screen callback blocks for the full registration lifetime
  • clear retained callback blocks only after unregistering callbacks
  • serialize frame-capture teardown on the capture queue so pending callbacks drain before native capture state is released

Root cause

A local npx @expo/serve-sim crash report showed SIGBUS on the frame-capture queue in serve-sim-native.node, symbolicated through FrameCapture.captureFrame() and FrameCapture.registerFrameCallbacks(desc:). The callback blocks were local Swift values passed through objc_msgSend; this keeps explicit strong references to them while SimulatorKit callbacks are registered.

Validation

  • npm exec --yes --package bun@latest -- bun run packages/serve-sim/build.ts
  • ./node_modules/.bin/tsc --noEmit

I did not live-test against a booted simulator because none were booted when validating this change.

@sjchmiela sjchmiela force-pushed the stanley/expo-serve-sim-03-vendor-livekit-webrtc branch from 32c5cf5 to 64ebdfd Compare June 30, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant