Fixed crash on startup on Windows

This commit is contained in:
Tomas Rycl 2017-10-09 13:33:30 +00:00 committed by Cheng Zhao
parent fe9ae41f98
commit 69cd33395a

View file

@ -181,10 +181,11 @@ void CommonWebContentsDelegate::SetOwnerWindow(
content::WebContents* web_contents, NativeWindow* owner_window) {
owner_window_ = owner_window ? owner_window->GetWeakPtr() : nullptr;
auto relay = base::MakeUnique<NativeWindowRelay>(owner_window_);
auto relay_key = relay->key;
if (owner_window) {
web_contents->SetUserData(relay->key, std::move(relay));
web_contents->SetUserData(relay_key, std::move(relay));
} else {
web_contents->RemoveUserData(relay->key);
web_contents->RemoveUserData(relay_key);
relay.reset();
}
}