Repository navigation
Fix iOS build: form owned-userdata release callback from a closure literal - #8897
Conversation
…e literal Commit f41507e passed the static method GhosttySurfaceBridge.releaseRetainedOpaque directly to ghostty_surface_new_with_owned_userdata, but Swift forms C function pointers only from global funcs or capture-free closure literals, so every iOS build of CmuxMobileTerminal fails, including the internal TestFlight lane. Wrap the call in a capture-free literal that forwards to the same method; behavior is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesSurface callback
Suggested reviewers: 🚥 Pre-merge checks | ✅ 25✅ Passed checks (25 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryFixes a Swift compiler error on iOS introduced by a prior commit that passed a static method reference directly as a C function pointer argument to
Confidence Score: 5/5Safe to merge — the change is a one-line mechanical fix that unblocks iOS compilation with no behavioral difference. The closure is genuinely capture-free, forwards the argument identically, and releaseRetainedOpaque has no actor isolation, so the C-callback invocation path is sound. No rules are violated and no logic is altered. Files Needing Attention: No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Swift as GhosttySurfaceView (Swift)
participant C as ghostty_surface_new_with_owned_userdata (C)
participant Closure as Capture-free closure
participant Bridge as GhosttySurfaceBridge.releaseRetainedOpaque
Swift->>Swift: Unmanaged.passRetained(bridge) → bridgePointer
Swift->>C: "ghostty_surface_new_with_owned_userdata(app, &config, closure)"
Note over Swift,C: Closure is capture-free — valid C function pointer
C-->>Swift: ghostty_surface_t (or nil)
Note over C,Closure: Later, when surface is freed
C->>Closure: invoke(userdata)
Closure->>Bridge: releaseRetainedOpaque(userdata)
Bridge->>Bridge: Unmanaged.fromOpaque(userdata).release()
Reviews (1): Last reviewed commit: "Fix iOS build: form the owned-userdata r..." | Re-trigger Greptile |
Main's iOS build is red since f41507e (an untested "cmux reload-cloud"-authored commit): it passes the static method GhosttySurfaceBridge.releaseRetainedOpaque directly as a C function pointer to ghostty_surface_new_with_owned_userdata, which Swift only permits for global funcs or capture-free closure literals. Every CmuxMobileTerminal compile fails, which killed internal TestFlight run 30139324698 (and blocks all iOS uploads). This wraps the callback in a capture-free closure literal forwarding to the same method; no behavior change. Verified against the language rule and gated on a local GhosttyKit rebuild before merge.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Fixes the iOS build by forming the owned-userdata release callback as a capture‑free closure literal when calling
ghostty_surface_new_with_owned_userdatainstead of passing the static method reference. This follows Swift’s C function pointer rules and restoresCmuxMobileTerminaliOS builds and TestFlight uploads with no behavior change.Written for commit a47e2fc. Summary will update on new commits.
Summary by CodeRabbit