Skip to content

Commit

Permalink
use weakptr vector in CloseAllWindows
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Apr 7, 2020
1 parent 39d92d9 commit 6fc806e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions shell/browser/window_list.cc
Expand Up @@ -93,10 +93,12 @@ void WindowList::RemoveObserver(WindowListObserver* observer) {
// static
void WindowList::CloseAllWindows() {
WindowVector windows = GetInstance()->windows_;
std::vector<base::WeakPtr<NativeWindow>> weak_windows =
ConvertToWeakPtrVector(windows);
#if defined(OS_MACOSX)
std::reverse(windows.begin(), windows.end());
std::reverse(weak_windows.begin(), weak_windows.end());
#endif
for (auto* const& window : windows) {
for (const auto& window : weak_windows) {
if (window && !window->IsClosed())
window->Close();
}
Expand Down

0 comments on commit 6fc806e

Please sign in to comment.