Open liqiwei1992 opened 8 years ago
Hi, thank you for the detailed bug report.
Regarding the error I believe the reason for it is different (did you try to prove the synchronized{}-theory?).
I believe the Fragment is loosing the activity (therefore getActivity()
return null) once the IodineVpnService switches the application status to CONNECT (l. 210) because then the IodineMain switches the Fragments (l. 42).
I won't promise you a date when I fix it but if you would like to do it then a PR is very welcome.
Kind regads, yves
Hi,
I have read the IodineMain.java
, FragmentList.java
and IodineVpnService.java
. I think you are totally right.
The event sequences to replay the crash is as follows:
The root cause may be like this. The first invocation of vpnServiceConnect2
sent an intent to broadcastReceiver
which started a new thread (IodineVpnService
). And this new thread sent new status to IodineMain
which switched the Fragments. Therefore, the second invocation of vpnServiceConnect2
get a null pointer after invocation of getActivity
.
Please point out mistakes in it.
Thanks!
ps. The onReceive
of BroadcastReceiver
is always called within the main thread of its process, unless you explicitly asked for it to be scheduled on a different thread using registerReceiver(BroadcastReceiver, IntentFilter, String, Handler)
. Therefore, there won't be synchronized problems.
My phone is too fast, I don't get a chance to click the item a second time :smiley: If you have a fix for this then feel free to open a PR
Hello,
When I use andiodine, I got a null pointer exception when andiodine attempts to connect the same address twice if I click the item quickly.
I read the code snippets about Connect in
IodineVpnService.java.
I found thatI think those code may lead to synchronization errors if it calls method
onReceive
twice. Therefore, andiodine should take extra synchronization (such asSynchronized {...}
) to fix it.And the stack trace is: