mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: cleanup how WebContents is destroyed (#27920)
This commit is contained in:
@@ -114,8 +114,7 @@ BaseWindow::BaseWindow(gin_helper::Arguments* args,
|
||||
}
|
||||
|
||||
BaseWindow::~BaseWindow() {
|
||||
if (!window_->IsClosed())
|
||||
window_->CloseImmediately();
|
||||
CloseImmediately();
|
||||
|
||||
// Destroy the native window in next tick because the native code might be
|
||||
// iterating all windows.
|
||||
@@ -318,6 +317,11 @@ void BaseWindow::SetContentView(gin::Handle<View> view) {
|
||||
window_->SetContentView(view->view());
|
||||
}
|
||||
|
||||
void BaseWindow::CloseImmediately() {
|
||||
if (!window_->IsClosed())
|
||||
window_->CloseImmediately();
|
||||
}
|
||||
|
||||
void BaseWindow::Close() {
|
||||
window_->Close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user