Index: chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc |
diff --git a/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc b/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc |
index d046ac36408cf4bdb7c91727309f13ce5fe53fa6..2b5fcb9f5db1cc43b95ff7a901a683bffc06be3a 100644 |
--- a/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc |
+++ b/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc |
@@ -87,21 +87,29 @@ void ChromeMetroViewerProcessHost::OnChannelError() { |
// connected. |
::SetEnvironmentVariableA(env_vars::kMetroConnected, NULL); |
- aura::RemoteWindowTreeHostWin::Instance()->Disconnected(); |
- chrome::DecrementKeepAliveCount(); |
- |
- // If browser is trying to quit, we shouldn't reenter the process. |
- // TODO(shrikant): In general there seem to be issues with how AttemptExit |
- // reentry works. In future release please clean up related code. |
- if (!browser_shutdown::IsTryingToQuit()) { |
- CloseOpenAshBrowsers(); |
- chrome::CloseAsh(); |
+ // It seems possible that channel is connected, but ASH desktop is not yet |
+ // created (instance is still NULL) and we receive channel error. |
+ if (aura::RemoteWindowTreeHostWin::Instance()) { |
+ aura::RemoteWindowTreeHostWin::Instance()->Disconnected(); |
+ |
+ chrome::DecrementKeepAliveCount(); |
+ |
+ // If browser is trying to quit, we shouldn't reenter the process. |
+ // TODO(shrikant): In general there seem to be issues with how AttemptExit |
+ // reentry works. In future release please clean up related code. |
+ if (!browser_shutdown::IsTryingToQuit()) { |
+ CloseOpenAshBrowsers(); |
+ chrome::CloseAsh(); |
+ } |
+ // Tell the rest of Chrome about it. |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_ASH_SESSION_ENDED, |
+ content::NotificationService::AllSources(), |
+ content::NotificationService::NoDetails()); |
+ return; |
} |
- // Tell the rest of Chrome about it. |
- content::NotificationService::current()->Notify( |
- chrome::NOTIFICATION_ASH_SESSION_ENDED, |
- content::NotificationService::AllSources(), |
- content::NotificationService::NoDetails()); |
+ |
+ chrome::DecrementKeepAliveCount(); |
// This will delete the MetroViewerProcessHost object. Don't access member |
// variables/functions after this call. |