diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index c888676b1960..b47e9e4f553e 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -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); } diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index 5867b1e6281a..5cdb49e41bbf 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -73,6 +73,9 @@ class Window : public mate::TrackableObject, void OnDevToolsClosed() override; void OnExecuteWindowsCommand(const std::string& command_name) override; + // mate::Wrappable: + bool IsDestroyed() const override; + private: // APIs for NativeWindow. void Destroy();