Add DestroyAllWindows helper that uses vector copy
This commit is contained in:
parent
bfb9388191
commit
8311aa667c
3 changed files with 11 additions and 2 deletions
|
@ -71,8 +71,7 @@ void Browser::Exit(mate::Arguments* args) {
|
||||||
} else {
|
} else {
|
||||||
// Unlike Quit(), we do not ask to close window, but destroy the window
|
// Unlike Quit(), we do not ask to close window, but destroy the window
|
||||||
// without asking.
|
// without asking.
|
||||||
for (NativeWindow* window : *window_list)
|
atom::WindowList::DestroyAllWindows();
|
||||||
window->CloseContents(nullptr); // e.g. Destroy()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,13 @@ void WindowList::CloseAllWindows() {
|
||||||
window->Close();
|
window->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void WindowList::DestroyAllWindows() {
|
||||||
|
WindowVector windows = GetInstance()->windows_;
|
||||||
|
for (const auto& window : windows)
|
||||||
|
window->CloseContents(nullptr); // e.g. Destroy()
|
||||||
|
}
|
||||||
|
|
||||||
WindowList::WindowList() {
|
WindowList::WindowList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,9 @@ class WindowList {
|
||||||
// Closes all windows.
|
// Closes all windows.
|
||||||
static void CloseAllWindows();
|
static void CloseAllWindows();
|
||||||
|
|
||||||
|
// Destroy all windows.
|
||||||
|
static void DestroyAllWindows();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WindowList();
|
WindowList();
|
||||||
~WindowList();
|
~WindowList();
|
||||||
|
|
Loading…
Reference in a new issue