Browse Source

Fixed crash on startup on Windows

Tomas Rycl 7 years ago
parent
commit
69cd33395a
1 changed files with 3 additions and 2 deletions
  1. 3 2
      atom/browser/common_web_contents_delegate.cc

+ 3 - 2
atom/browser/common_web_contents_delegate.cc

@@ -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();
   }
 }