mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Check BrowserWindow's lifetime
This commit is contained in:
@@ -177,6 +177,10 @@ mate::Wrappable* Window::New(v8::Isolate* isolate,
|
||||
return new Window(isolate, options);
|
||||
}
|
||||
|
||||
bool Window::IsDestroyed() const {
|
||||
return !window_ || window_->IsClosed();
|
||||
}
|
||||
|
||||
void Window::Destroy() {
|
||||
window_->CloseContents(nullptr);
|
||||
}
|
||||
|
||||
@@ -73,6 +73,9 @@ class Window : public mate::TrackableObject<Window>,
|
||||
void OnDevToolsClosed() override;
|
||||
void OnExecuteWindowsCommand(const std::string& command_name) override;
|
||||
|
||||
// mate::Wrappable:
|
||||
bool IsDestroyed() const override;
|
||||
|
||||
private:
|
||||
// APIs for NativeWindow.
|
||||
void Destroy();
|
||||
|
||||
Reference in New Issue
Block a user