Merge pull request #919 from paulcbetts/nullref-in-webview-manager
Fix nullref crash in WebViewManager::RemoveGuest
This commit is contained in:
commit
4fa7e8e914
1 changed files with 6 additions and 0 deletions
|
@ -80,13 +80,19 @@ void WebViewManager::AddGuest(int guest_instance_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebViewManager::RemoveGuest(int guest_instance_id) {
|
void WebViewManager::RemoveGuest(int guest_instance_id) {
|
||||||
|
if (!ContainsKey(web_contents_map_, guest_instance_id)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto web_contents = web_contents_map_[guest_instance_id].web_contents;
|
auto web_contents = web_contents_map_[guest_instance_id].web_contents;
|
||||||
|
|
||||||
content::BrowserThread::PostTask(
|
content::BrowserThread::PostTask(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
content::BrowserThread::IO, FROM_HERE,
|
||||||
base::Bind(
|
base::Bind(
|
||||||
&WebViewRendererState::RemoveGuest,
|
&WebViewRendererState::RemoveGuest,
|
||||||
base::Unretained(WebViewRendererState::GetInstance()),
|
base::Unretained(WebViewRendererState::GetInstance()),
|
||||||
web_contents->GetRenderProcessHost()->GetID()));
|
web_contents->GetRenderProcessHost()->GetID()));
|
||||||
|
|
||||||
web_contents_map_.erase(guest_instance_id);
|
web_contents_map_.erase(guest_instance_id);
|
||||||
|
|
||||||
// Remove the record of element in embedder too.
|
// Remove the record of element in embedder too.
|
||||||
|
|
Loading…
Reference in a new issue