]> khamidou — GitHub mirrors - electron.git/commitdiff
At Browser ctor time, DIR_USER_DATA is unset, wait
authorPaul Betts <paul@paulbetts.org>
Tue, 20 Oct 2015 00:37:26 +0000 (17:37 -0700)
committerPaul Betts <paul@paulbetts.org>
Tue, 20 Oct 2015 20:16:49 +0000 (13:16 -0700)
atom/browser/browser.cc

index 3c55be68824cb3199e076f9279ee80d29c40f7bc..39c348bcd6d20353b4c86056f7b0538b964c3408 100644 (file)
@@ -21,16 +21,6 @@ Browser::Browser()
       is_ready_(false),
       is_shutdown_(false),
       process_notify_callback_(NULL) {
-  base::FilePath userDir;
-  PathService::Get(brightray::DIR_USER_DATA, &userDir);
-  
-  auto no_refcount_this = base::Unretained(this);
-  process_singleton_.reset(new AtomProcessSingleton(
-    userDir, 
-    base::Bind(&Browser::OnProcessSingletonNotification, no_refcount_this)));
-    
-  process_notify_result_ = process_singleton_->NotifyOtherProcessOrCreate();
-  
   WindowList::AddObserver(this);
 }
 
@@ -122,6 +112,17 @@ void Browser::Activate(bool has_visible_windows) {
 }
 
 void Browser::WillFinishLaunching() {
+  base::FilePath userDir;
+  PathService::Get(brightray::DIR_USER_DATA, &userDir);
+  
+  auto no_refcount_this = base::Unretained(this);
+  process_singleton_.reset(new AtomProcessSingleton(
+    userDir,
+    base::Bind(&Browser::OnProcessSingletonNotification, no_refcount_this)));
+
+  LOG(ERROR) << "Setting up Process Singleton: " << userDir.value();
+  process_notify_result_ = process_singleton_->NotifyOtherProcessOrCreate();
+
   FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWillFinishLaunching());
 }