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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 2881563002: memory-infra: Fix deadlock in MemoryDumpManager (Closed)
Patch Set: remove brackets 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_dump_manager.cc
diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc
index 8d307cef5cbe7c0dc5eafad2bddf6f9ea08e0687..32c93f7558e2900ebbaf0c87efe19c3b9e824a20 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -173,11 +173,18 @@ MemoryDumpManager::MemoryDumpManager()
}
MemoryDumpManager::~MemoryDumpManager() {
- AutoLock lock(lock_);
- if (dump_thread_) {
- dump_thread_->Stop();
- dump_thread_.reset();
+ Thread* dump_thread = nullptr;
+ {
+ AutoLock lock(lock_);
+ if (dump_thread_) {
+ dump_thread = dump_thread_.get();
+ }
+ }
+ if (dump_thread) {
+ dump_thread->Stop();
}
+ AutoLock lock(lock_);
+ dump_thread_.reset();
}
void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698