AdguardForAndroid icon indicating copy to clipboard operation
AdguardForAndroid copied to clipboard

Crash when making change on the Userscript state and returning back

Open robifr opened this issue 1 year ago • 2 comments

v4.4. nightly 1 android 13

this crash happen when user make a change on the setting way too fast, before adguard have a chance to restart, and user already make another change.

fastest way to reproduce this bug:

  1. open setting,
  2. open filtering,
  3. open userscripts,
  4. toggle userscript from on to off and vice versa,
  5. click back until the main menu settings,
  6. notice adguard is now disabled and trying to apply the change,
  7. now repeat step-2 until step-5, but this time as fast as possible before adguard is enabled again.
java.lang.IllegalStateException: Fragment FilteringSettingsFragment{4d75f1d} (79b0d2e6-7506-4987-887e-8a9c39600a04) not attached to a context.
	at androidx.fragment.app.Fragment.requireContext(Fragment.java:32)
	at androidx.fragment.app.Fragment.getResources(Fragment.java:1)
	at androidx.fragment.app.Fragment.getString(Fragment.java:2)
	at com.adguard.android.ui.fragment.preferences.FilteringSettingsFragment$b$a.invoke(FilteringSettingsFragment.kt:11)
	at com.adguard.android.ui.fragment.preferences.FilteringSettingsFragment$b$a.invoke(FilteringSettingsFragment.kt:1)
	at g8.a$f.invoke(Animation.kt:2)
	at g8.a$f.invoke(Animation.kt:1)
	at g8.a$c.onAnimationEnd(Animator.kt:10)
	at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:600)
	at android.animation.AnimatorSet.endAnimation(AnimatorSet.java:1301)
	at android.animation.AnimatorSet.doAnimationFrame(AnimatorSet.java:1086)
	at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:307)
	at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(Unknown Source:0)
	at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:86)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1489)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1499)
	at android.view.Choreographer.doCallbacks(Choreographer.java:1114)
	at android.view.Choreographer.doFrame(Choreographer.java:1026)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1467)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:211)
	at android.os.Looper.loop(Looper.java:300)
	at android.app.ActivityThread.main(ActivityThread.java:8410)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)

robifr avatar Dec 25 '23 10:12 robifr

there's another way to reproduce it, just without repeating the steps.

  1. open setting
  2. open filtering
  3. open userscripts
  4. toggle userscript from on to off and vice versa,
  5. wait until adguard is disabled,
  6. immediately click back until main menu settings before adguard is enabled again.

robifr avatar Dec 25 '23 11:12 robifr

@robifr Thank you for reporting! Reproduces on our side as well, this bug will be fixed.

Versty avatar Jan 16 '24 13:01 Versty