Commit 6854da52 authored by rockot's avatar rockot Committed by Commit bot

Fix nullptr dereference in MojoShellConnectionImpl

ShutdownOnIOThread may be called more than once. If this happens,
the MessageLoop observer will be null during the second call.
This ensures that we don't dereference it in that case.

BUG=None
TBR=ben@chromium.org

Review-Url: https://codereview.chromium.org/2259753002
Cr-Commit-Position: refs/heads/master@{#412768}
parent f6c0a82b
......@@ -178,8 +178,10 @@ class MojoShellConnectionImpl::IOThreadContext
// Note that this method may be invoked by MessageLoopObserver observing
// MessageLoop destruction. In that case, this call to ShutDown is
// effectively a no-op. In any case it's safe.
message_loop_observer_->ShutDown();
message_loop_observer_ = nullptr;
if (message_loop_observer_) {
message_loop_observer_->ShutDown();
message_loop_observer_ = nullptr;
}
// Resetting the ServiceContext below may otherwise release the last
// reference to this IOThreadContext. We keep it alive until the stack
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment