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

Side by Side Diff: content/common/mojo/mojo_shell_connection_impl.cc

Issue 2259753002: Fix nullptr dereference in MojoShellConnectionImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/mojo/mojo_shell_connection_impl.h" 5 #include "content/common/mojo/mojo_shell_connection_impl.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 171 }
172 172
173 void ShutDownOnIOThread() { 173 void ShutDownOnIOThread() {
174 DCHECK(io_thread_checker_.CalledOnValidThread()); 174 DCHECK(io_thread_checker_.CalledOnValidThread());
175 175
176 weak_factory_.InvalidateWeakPtrs(); 176 weak_factory_.InvalidateWeakPtrs();
177 177
178 // Note that this method may be invoked by MessageLoopObserver observing 178 // Note that this method may be invoked by MessageLoopObserver observing
179 // MessageLoop destruction. In that case, this call to ShutDown is 179 // MessageLoop destruction. In that case, this call to ShutDown is
180 // effectively a no-op. In any case it's safe. 180 // effectively a no-op. In any case it's safe.
181 message_loop_observer_->ShutDown(); 181 if (message_loop_observer_) {
182 message_loop_observer_ = nullptr; 182 message_loop_observer_->ShutDown();
183 message_loop_observer_ = nullptr;
184 }
183 185
184 // Resetting the ServiceContext below may otherwise release the last 186 // Resetting the ServiceContext below may otherwise release the last
185 // reference to this IOThreadContext. We keep it alive until the stack 187 // reference to this IOThreadContext. We keep it alive until the stack
186 // unwinds. 188 // unwinds.
187 scoped_refptr<IOThreadContext> keepalive(this); 189 scoped_refptr<IOThreadContext> keepalive(this);
188 190
189 factory_bindings_.CloseAllBindings(); 191 factory_bindings_.CloseAllBindings();
190 service_context_.reset(); 192 service_context_.reset();
191 193
192 base::AutoLock lock(lock_); 194 base::AutoLock lock(lock_);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 490
489 void MojoShellConnectionImpl::GetInterface( 491 void MojoShellConnectionImpl::GetInterface(
490 shell::mojom::InterfaceProvider* provider, 492 shell::mojom::InterfaceProvider* provider,
491 const std::string& interface_name, 493 const std::string& interface_name,
492 mojo::ScopedMessagePipeHandle request_handle) { 494 mojo::ScopedMessagePipeHandle request_handle) {
493 provider->GetInterface(interface_name, std::move(request_handle)); 495 provider->GetInterface(interface_name, std::move(request_handle));
494 } 496 }
495 497
496 } // namespace content 498 } // namespace content
497 499
OLDNEW
« 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