Browse Source

fix: mac window crash native theme update (#31429)

Co-authored-by: Samuel Maddock <[email protected]>
trop[bot] 3 years ago
parent
commit
715de396d4
1 changed files with 7 additions and 0 deletions
  1. 7 0
      shell/browser/native_window_mac.mm

+ 7 - 0
shell/browser/native_window_mac.mm

@@ -324,6 +324,13 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
   window_ = static_cast<ElectronNSWindow*>(
       widget()->GetNativeWindow().GetNativeNSWindow());
 
+  RegisterDeleteDelegateCallback(base::BindOnce(
+      [](NativeWindowMac* window) {
+        if (window->window_)
+          window->window_ = nil;
+      },
+      this));
+
   [window_ setEnableLargerThanScreen:enable_larger_than_screen()];
 
   window_delegate_.reset([[ElectronNSWindowDelegate alloc] initWithShell:this]);