Skip to content

Keep an IPC's worklet alive for as long as the IPC - #107

Merged
bavulapati merged 3 commits into
mainfrom
ipc-keeps-worklet
Aug 14, 2026
Merged

bavulapati merged 3 commits into
mainfrom
ipc-keeps-worklet

Conversation

@bavulapati

Copy link
Copy Markdown
Contributor

Both bindings take a worklet in the constructor, reach into it, and drop the reference. So a BareIPC or a Java IPC can outlive the worklet it was opened on, with ARC or the collector picking the order.

Twelve lines to hold it in each, which makes the object graph say what is already true: an IPC without its worklet is meaningless.

Harmless on its own today. It becomes load-bearing with #106, where the queue belongs to the worklet and the host must retire its ipc first. Split out of #94.

Both bindings took a worklet, reached into it, and then dropped the reference, so
an IPC could outlive the worklet it was opened on with ARC or the collector
deciding the order. Hold it in each, which orders the teardown the way the
objects are actually related.
kasperisager
kasperisager previously approved these changes Aug 14, 2026
The first cut assigned the ivar and called it ownership, but this file is manual
reference counting: the assignment held nothing, so an IPC could still outlive
its worklet. Retain it, release it in dealloc, and assert the reference exists -
the test fails on the assignment-only version.
@bavulapati
bavulapati merged commit 6cfa04e into main Aug 14, 2026
11 checks passed
@bavulapati
bavulapati deleted the ipc-keeps-worklet branch August 14, 2026 13:07
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.

2 participants