Revert "Clear port_ before firing destroyed event."

This reverts commit ca94696ae257395b452048535b3b86e95dbf47c4.

Reason for revert: Downstream needs updating.

Original change's description:
> Clear port_ before firing destroyed event.
>
> This reverts a change introduced last week in [1] whereby the port_
> pointer would be valid while firing the `Destroyed` event.
>
> [1] https://webrtc-review.googlesource.com/c/src/+/259826
>
> Bug: webrtc:13892, webrtc:13865
> Change-Id: I9c7be8fa9a5603fbdbf0debd91e2d4e21b303270
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260860
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#36728}

Bug: webrtc:13892, webrtc:13865
Change-Id: Ic7571fa8433897b348ca9a8f73ceae68014fe0c6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260921
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#36735}
This commit is contained in:
Tomas Gunnarsson 2022-05-02 19:05:38 +00:00 committed by WebRTC LUCI CQ
parent 0a16276290
commit edeeef24a6

View File

@ -843,12 +843,6 @@ bool Connection::Shutdown() {
RTC_DLOG(LS_VERBOSE) << ToString() << ": Connection destroyed"; RTC_DLOG(LS_VERBOSE) << ToString() << ": Connection destroyed";
LogCandidatePairConfig(webrtc::IceCandidatePairConfigType::kDestroyed);
// Reset the `port_` after logging since information required for logging
// needs access to `port_`.
port_.reset();
// Fire the 'destroyed' event before deleting the object. This is done // Fire the 'destroyed' event before deleting the object. This is done
// intentionally to avoid a situation whereby the signal might have dangling // intentionally to avoid a situation whereby the signal might have dangling
// pointers to objects that have been deleted by the time the async task // pointers to objects that have been deleted by the time the async task
@ -856,6 +850,12 @@ bool Connection::Shutdown() {
SignalDestroyed(this); SignalDestroyed(this);
SignalDestroyed.disconnect_all(); SignalDestroyed.disconnect_all();
LogCandidatePairConfig(webrtc::IceCandidatePairConfigType::kDestroyed);
// Reset the `port_` after logging and firing the destroyed signal since
// information required for logging needs access to `port_`.
port_.reset();
return true; return true;
} }