Commit 70aa867c authored by Max Lv's avatar Max Lv

Fix a race condition

parent f4b18b61
...@@ -208,6 +208,8 @@ class Shadowsocks ...@@ -208,6 +208,8 @@ class Shadowsocks
.putString(Key.proxied, DBHelper.updateProxiedApps(this, oldProxiedApps)).apply() .putString(Key.proxied, DBHelper.updateProxiedApps(this, oldProxiedApps)).apply()
recovery() recovery()
updateCurrentProfile()
} }
} }
...@@ -496,10 +498,7 @@ class Shadowsocks ...@@ -496,10 +498,7 @@ class Shadowsocks
} }
} }
protected override def onResume() { private def updateCurrentProfile() {
super.onResume()
ConfigUtils.refresh(this)
// Check if current profile changed // Check if current profile changed
if (ShadowsocksApplication.profileId != currentProfile.id) { if (ShadowsocksApplication.profileId != currentProfile.id) {
currentProfile = ShadowsocksApplication.currentProfile match { currentProfile = ShadowsocksApplication.currentProfile match {
...@@ -515,6 +514,14 @@ class Shadowsocks ...@@ -515,6 +514,14 @@ class Shadowsocks
if (serviceStarted) serviceLoad() if (serviceStarted) serviceLoad()
} }
}
protected override def onResume() {
super.onResume()
ConfigUtils.refresh(this)
updateCurrentProfile()
updateState() updateState()
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment