Commit 8b5604b
fix: guard OnStateChange against null _jingleDataChannel
OnPeerConnectionClosed() dispatches a kClosed event and calls Stop(),
but the network thread can still fire OnStateChange() concurrently.
If OnStateChange runs after OnPeerConnectionClosed has already called
CleanupInternals (which sets _jingleDataChannel to nullptr), accessing
_jingleDataChannel->state() crashes with a null pointer dereference.
Remove the redundant CleanupInternals() call from OnPeerConnectionClosed
(added in 33ceabf) — its purpose was to dispatch close events before
PeerConnection::Close() cancels SafeTask callbacks, but HandleStateChange
already does that. CleanupInternals will still run when OnStateChange
receives kClosed from the network thread.
Add a null guard in OnStateChange for the case where it races with
OnPeerConnectionClosed during shutdown.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 826a0f8 commit 8b5604b
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | 122 | | |
124 | 123 | | |
125 | 124 | | |
126 | 125 | | |
127 | 126 | | |
128 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| |||
0 commit comments