Fix crash when calling app.quit() before app is ready

This commit is contained in:
Cheng Zhao 2015-10-22 16:06:37 +08:00
parent 230f2760e7
commit ca876e424b

View file

@ -53,8 +53,14 @@ void Browser::Shutdown() {
is_quiting_ = true; is_quiting_ = true;
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit()); FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit());
base::MessageLoop::current()->PostTask(
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); if (base::MessageLoop::current()) {
base::MessageLoop::current()->PostTask(
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
} else {
// There is no message loop available so we are in early stage.
exit(0);
}
} }
std::string Browser::GetVersion() const { std::string Browser::GetVersion() const {