Skip to content

Commit bbb62be

Browse files
committed
fix a race condition
1 parent b272d7a commit bbb62be

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/main/scala/com/github/shadowsocks/Shadowsocks.scala

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class Shadowsocks
250250

251251
private lazy val application = getApplication.asInstanceOf[ShadowsocksApplication]
252252

253-
var handler: Handler = null
253+
var handler = new Handler()
254254

255255
def isSinglePane: Boolean = {
256256
if (singlePane == -1) {
@@ -479,8 +479,6 @@ class Shadowsocks
479479

480480
super.onCreate(savedInstanceState)
481481

482-
handler = new Handler()
483-
484482
addPreferencesFromResource(R.xml.pref_all)
485483

486484
// Update the profile
@@ -901,10 +899,7 @@ class Shadowsocks
901899
deattachService()
902900
unregisterReceiver(preferenceReceiver)
903901
new BackupManager(this).dataChanged()
904-
if (handler != null) {
905-
handler.removeCallbacksAndMessages(null)
906-
handler = null
907-
}
902+
handler.removeCallbacksAndMessages(null)
908903
}
909904

910905
def copyToSystem() {

0 commit comments

Comments
 (0)