Commit aed63088 authored by Mygod's avatar Mygod

Fix a race condition

parent 9fb0639f
...@@ -134,6 +134,7 @@ trait BaseService extends Service { ...@@ -134,6 +134,7 @@ trait BaseService extends Service {
def updateTrafficTotal(tx: Long, rx: Long) { def updateTrafficTotal(tx: Long, rx: Long) {
val handler = new Handler(getContext.getMainLooper) val handler = new Handler(getContext.getMainLooper)
handler.post(() => { handler.post(() => {
val config = this.config // avoid race conditions without locking
if (config != null) { if (config != null) {
ShadowsocksApplication.profileManager.getProfile(config.profileId) match { ShadowsocksApplication.profileManager.getProfile(config.profileId) match {
case Some(profile) => case Some(profile) =>
......
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