From e5094fff3eb06b9feae8ac5e6bf22b7cffe90b87 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Tue, 20 Oct 2015 17:27:28 -0700 Subject: [PATCH] Since setting up process_singleton is now conditional, its cleanup / unlock must be too --- atom/browser/browser.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/atom/browser/browser.cc b/atom/browser/browser.cc index 4308395eb7..483e58a988 100644 --- a/atom/browser/browser.cc +++ b/atom/browser/browser.cc @@ -117,7 +117,11 @@ void Browser::WillFinishLaunching() { void Browser::DidFinishLaunching() { is_ready_ = true; - process_singleton_->Unlock(); + + if (process_notify_callback_set_) { + process_singleton_->Unlock(); + } + FOR_EACH_OBSERVER(BrowserObserver, observers_, OnFinishLaunching()); } @@ -144,7 +148,10 @@ void Browser::NotifyAndShutdown() { return; } - process_singleton_->Cleanup(); + if (process_notify_callback_set_) { + process_singleton_->Cleanup(); + } + Shutdown(); } @@ -167,6 +174,10 @@ void Browser::InitializeSingleInstance() { base::Bind(&Browser::OnProcessSingletonNotification, no_refcount_this))); process_notify_result_ = process_singleton_->NotifyOtherProcessOrCreate(); + + if (is_ready_) { + process_singleton_->Unlock(); + } } ProcessSingleton::NotifyResult Browser::GetSingleInstanceResult() {