From c6a4fcb9595cb11ea42f23cbe2b7a1eedd9b245f Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Tue, 12 Nov 2019 13:07:00 +0200 Subject: [PATCH] ui: fix Account watching bug Account::is_online(&mut self) should be called from ui/src/state.rs only, since it launches the watcher threads when an account goes from offline to online. If it's called from elsewhere the watcher threads might not get launched ever. --- ui/src/conf/accounts.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/src/conf/accounts.rs b/ui/src/conf/accounts.rs index 43762cd7..2315d650 100644 --- a/ui/src/conf/accounts.rs +++ b/ui/src/conf/accounts.rs @@ -279,7 +279,6 @@ impl Account { event_queue: VecDeque::with_capacity(8), }; - ret.is_online(); ret } fn init(&mut self) { @@ -809,6 +808,8 @@ impl Account { ret.as_ref().map(|r| r.0.as_str()) } + /* Call only in Context::is_online, since only Context can launch the watcher threads if an + * account goes from offline to online. */ pub fn is_online(&mut self) -> bool { let ret = self.backend.read().unwrap().is_online(); if ret != self.is_online && ret {