Fix a race condition
This commit is contained in:
@@ -208,6 +208,8 @@ class Shadowsocks
|
||||
.putString(Key.proxied, DBHelper.updateProxiedApps(this, oldProxiedApps)).apply()
|
||||
|
||||
recovery()
|
||||
|
||||
updateCurrentProfile()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,10 +498,7 @@ class Shadowsocks
|
||||
}
|
||||
}
|
||||
|
||||
protected override def onResume() {
|
||||
super.onResume()
|
||||
ConfigUtils.refresh(this)
|
||||
|
||||
private def updateCurrentProfile() {
|
||||
// Check if current profile changed
|
||||
if (ShadowsocksApplication.profileId != currentProfile.id) {
|
||||
currentProfile = ShadowsocksApplication.currentProfile match {
|
||||
@@ -515,6 +514,14 @@ class Shadowsocks
|
||||
|
||||
if (serviceStarted) serviceLoad()
|
||||
}
|
||||
}
|
||||
|
||||
protected override def onResume() {
|
||||
super.onResume()
|
||||
|
||||
ConfigUtils.refresh(this)
|
||||
|
||||
updateCurrentProfile()
|
||||
|
||||
updateState()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user