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

Unified Diff: ash/mus/window_manager_application.cc

Issue 2861773003: chromeos: Fix crash when clicking on networking menu under mash (Closed)
Patch Set: review comments Created 3 years, 8 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 | « ash/mus/window_manager_application.h ('k') | ash/system/network/network_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/window_manager_application.cc
diff --git a/ash/mus/window_manager_application.cc b/ash/mus/window_manager_application.cc
index 3594bf3237f3dd370aa89b1249dc03962e1df08f..2594871853f8089ff788e686d2a708825236d9f4 100644
--- a/ash/mus/window_manager_application.cc
+++ b/ash/mus/window_manager_application.cc
@@ -95,16 +95,21 @@ void WindowManagerApplication::InitializeComponents(bool init_network_handler) {
message_center::MessageCenter::Initialize();
// Must occur after mojo::ApplicationRunner has initialized AtExitManager, but
- // before WindowManager::Init().
- chromeos::DBusThreadManager::Initialize(
- chromeos::DBusThreadManager::PROCESS_ASH);
+ // before WindowManager::Init(). Tests might initialize their own instance.
+ if (!chromeos::DBusThreadManager::IsInitialized()) {
+ chromeos::DBusThreadManager::Initialize(
+ chromeos::DBusThreadManager::PROCESS_ASH);
+ dbus_thread_manager_initialized_ = true;
+ }
// See ChromeBrowserMainPartsChromeos for ordering details.
bluez::BluezDBusManager::Initialize(
chromeos::DBusThreadManager::Get()->GetSystemBus(),
chromeos::DBusThreadManager::Get()->IsUsingFakes());
- if (init_network_handler)
+ if (init_network_handler && !chromeos::NetworkHandler::IsInitialized()) {
chromeos::NetworkHandler::Initialize();
+ network_handler_initialized_ = true;
+ }
network_connect_delegate_.reset(new NetworkConnectDelegateMus());
chromeos::NetworkConnect::Initialize(network_connect_delegate_.get());
// TODO(jamescook): Initialize real audio handler.
@@ -117,11 +122,12 @@ void WindowManagerApplication::ShutdownComponents() {
chromeos::NetworkConnect::Shutdown();
network_connect_delegate_.reset();
// We may not have started the NetworkHandler.
- if (chromeos::NetworkHandler::IsInitialized())
+ if (network_handler_initialized_)
chromeos::NetworkHandler::Shutdown();
device::BluetoothAdapterFactory::Shutdown();
bluez::BluezDBusManager::Shutdown();
- chromeos::DBusThreadManager::Shutdown();
+ if (dbus_thread_manager_initialized_)
+ chromeos::DBusThreadManager::Shutdown();
message_center::MessageCenter::Shutdown();
}
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | ash/system/network/network_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698