You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Room never disposed its RoomHandle on Disconnect(), and Participant /
TrackPublication / Track never disposed theirs at all. Each handle is an
independent entry in the Rust FFI handle table, so dropping one does not
cascade. The handles only got freed when GC eventually finalized each
SafeHandle, which in practice meant the entire Rust-side room (peer
connection, signaling client, libwebrtc state) plus every wrapped
participant, publication, and track lingered for an unpredictable amount
of time after the user-visible session had ended.
Make Room implement IDisposable. Disconnect() now sends the FFI request
and then runs Cleanup(), which unsubscribes from FfiClient events,
walks LocalParticipant + RemoteParticipants disposing each
participant + its publications + the publications' tracks, and finally
disposes RoomHandle itself. The same Cleanup() runs from the
Disconnected room event so server-initiated drops behave the same as
client-initiated ones. OnEventReceived guards against late events
arriving after Cleanup, so the FfiClient unsubscribe race is harmless.
DisposeHandles is added as an internal cascade: Track disposes its own
handle, TrackPublication forwards to its Track, RemoteTrackPublication
also disposes its publication handle, and Participant walks _tracks
before disposing its own handle.
The Meet sample's OnDestroy also calls Disconnect now so a scene change
or quit while still connected releases the handles instead of leaking
them until process exit.
Verified with the FFI handle table diagnostic: a connect / hold /
disconnect cycle now drops rooms, participants, tracks, and remote
publications back to zero. Local publications and audio/video source
handles still leak on this path; those are addressed separately.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments