Index: mojo/edk/system/raw_channel.cc |
diff --git a/mojo/edk/system/raw_channel.cc b/mojo/edk/system/raw_channel.cc |
index 5d0a04c47273dfddbfaa8c02f66bac8b4bd11205..93c2d05d61f4a97c7050d26cdbc9ffc196c65806 100644 |
--- a/mojo/edk/system/raw_channel.cc |
+++ b/mojo/edk/system/raw_channel.cc |
@@ -726,8 +726,13 @@ void RawChannel::CallOnReadCompleted(IOResult io_result, size_t bytes_read) { |
} |
void RawChannel::WillDestroyCurrentMessageLoop() { |
- base::AutoLock locker(read_lock_); |
- OnReadCompletedNoLock(IO_FAILED_SHUTDOWN, 0); |
+ { |
+ base::AutoLock locker(read_lock_); |
+ OnReadCompletedNoLock(IO_FAILED_SHUTDOWN, 0); |
+ } |
+ // The PostTask inside Shutdown() will never be called, so manually call it |
+ // here to avoid leaks in LSAN builds. |
+ Shutdown(); |
} |
} // namespace edk |