Check if it is guest process before updating process ID
authorCheng Zhao <zcbenz@gmail.com>
Sun, 26 Apr 2015 09:26:00 +0000 (17:26 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 27 Apr 2015 07:11:59 +0000 (15:11 +0800)
atom/browser/atom_browser_client.cc
atom/browser/web_view_manager.cc

index 8f1bb41..0ee2c7f 100644 (file)
@@ -159,8 +159,8 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
       child_process_id = dying_process_id;
     } else {
       // It appears that the dying process doesn't belong to a BrowserWindow,
-      // then it must be a guest process, we should update its process ID in the
-      // WebViewManager here.
+      // then it might be a guest process, if it is we should update its
+      // process ID in the WebViewManager.
       auto child_process = content::RenderProcessHost::FromID(child_process_id);
       // Update the process ID in webview guests.
       WebViewManager::UpdateGuestProcessID(dying_render_process_,
index 9de3088..77a772d 100644 (file)
@@ -41,6 +41,8 @@ void WebViewManager::UpdateGuestProcessID(
     base::AutoLock auto_lock(manager->lock_);
     int old_id = old_process->GetID();
     int new_id = new_process->GetID();
+    if (!ContainsKey(manager->webview_info_map_, old_id))
+      return;
     manager->webview_info_map_[new_id] = manager->webview_info_map_[old_id];
     manager->webview_info_map_.erase(old_id);
   }