destruct objects in stack order

This commit is contained in:
Cheng Zhao 2018-05-17 09:09:45 +09:00
parent fd4a0626c5
commit aeeb2a259f

View file

@ -121,7 +121,10 @@ int AtomBrowserMainParts::GetExitCode() {
void AtomBrowserMainParts::RegisterDestructionCallback( void AtomBrowserMainParts::RegisterDestructionCallback(
base::OnceClosure callback) { base::OnceClosure callback) {
destructors_.insert(destructors_.end(), std::move(callback)); // The destructors should be called in reversed order, so dependencies between
// JavaScript objects can be correctly resolved.
// For example WebContentsView => WebContents => Session.
destructors_.insert(destructors_.begin(), std::move(callback));
} }
void AtomBrowserMainParts::PreEarlyInitialization() { void AtomBrowserMainParts::PreEarlyInitialization() {