Repository navigation
fix: native observer and object lifecycles around closing a connection - #456
Merged
Merged
Conversation
WebRTC posts the result of setting a description and drops it, together with the observer, when the connection goes away first; the observer was never called. Like AddIceCandidateObserver, it now reports INVALID_STATE from its destructor if it has not reported anything yet.
getTransport() handed out a pointer it held no reference on, so once the connection had closed and the sender or receiver was gone, reading the transport or unregistering its observer touched freed memory. The Java object now holds a reference, released by the new dispose(), and getTransport() returns null while there is no transport.
close() closed and freed the connection right away, while WebRTC goes on with it after an observer callback returns, e.g. after reporting CONNECTED or while applying a remote description; the VM crashed. Called on the factory's signaling thread, close() now posts the close to run once the callback has returned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RTCPeerConnection.close()called from an observer callback freed the connection while WebRTC was still using it, crashing the VM (e.g. onCONNECTED, or while applying a remote description). Called on the signaling thread, the close now runs once the callback has returned.RTCDtlsTransportheld no reference on the native transport, so it pointed to freed memory once the connection had closed and the sender or receiver was gone. It now holds one, released by the newdispose();getTransport()returns null while there is no transport.SetSessionDescriptionObserverwhose result WebRTC dropped because the connection went away was never called. It now reportsINVALID_STATE, asAddIceCandidateObserveralready does.