Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: webrtc/base/asyncinvoker.cc

Issue 2846593005: Relanding #2: Fixing crash that can occur if signal is modified while firing. (Closed)
Patch Set: Fixing issue with disconnect_all, adding test, simplifying code a bit Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/asyncinvoker.h ('k') | webrtc/base/sigslot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/asyncinvoker.cc
diff --git a/webrtc/base/asyncinvoker.cc b/webrtc/base/asyncinvoker.cc
index a143e25f19341bd2d3368c991aca8ab9c1e4d418..cabd8b506d0575ee3e3b41a479f6f7b9fcf63ee8 100644
--- a/webrtc/base/asyncinvoker.cc
+++ b/webrtc/base/asyncinvoker.cc
@@ -20,7 +20,6 @@ AsyncInvoker::AsyncInvoker() : invocation_complete_(false, false) {}
AsyncInvoker::~AsyncInvoker() {
destroying_ = true;
- SignalInvokerDestroyed();
// Messages for this need to be cleared *before* our destructor is complete.
MessageQueueManager::Clear(this);
// And we need to wait for any invocations that are still in progress on
@@ -126,8 +125,9 @@ NotifyingAsyncClosureBase::NotifyingAsyncClosureBase(
calling_thread_(calling_thread) {
calling_thread->SignalQueueDestroyed.connect(
this, &NotifyingAsyncClosureBase::CancelCallback);
- invoker->SignalInvokerDestroyed.connect(
- this, &NotifyingAsyncClosureBase::CancelCallback);
+ // Note: We don't need to listen for the invoker being destroyed, because it
+ // will wait for this closure to be destroyed (and pending_invocations_ to go
+ // to 0) before its destructor completes.
}
NotifyingAsyncClosureBase::~NotifyingAsyncClosureBase() {
« no previous file with comments | « webrtc/base/asyncinvoker.h ('k') | webrtc/base/sigslot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698