runnerup icon indicating copy to clipboard operation
runnerup copied to clipboard

window leak in AccountListActivity

Open anlalalu opened this issue 6 years ago • 5 comments

Reproduction Steps
  1. tap 'feed'
  2. tap 'EDIT ACCOUNTs'
  3. tap 'connect an account'
  4. rotate the screen
Stack Trace

E/WindowManager: android.view.WindowLeaked: Activity org.runnerup.view.AccountListActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{527f1cb4 V.E..... R....... 0,0-729,192} that was originally added here at android.view.ViewRootImpl.(ViewRootImpl.java:346) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) at android.app.Dialog.show(Dialog.java:286) at org.runnerup.export.SyncManager.connect(SyncManager.java:268) at org.runnerup.view.AccountListActivity$2.onItemClick(AccountListActivity.java:291) at android.widget.AdapterView.performItemClick(AdapterView.java:299) at android.widget.AbsListView.performItemClick(AbsListView.java:1113) at android.widget.AbsListView$PerformClick.run(AbsListView.java:2911) at android.widget.AbsListView$3.run(AbsListView.java:3645) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method)

Debug info

App Version = 2.0.3.0

Android Version = 4.4.4

maybe can be solved like this: https://stackoverflow.com/questions/2850573/activity-has-leaked-window-that-was-originally-added

anlalalu avatar Dec 18 '19 09:12 anlalalu

Which account did you try to add? Adding an account will start the auth activity, maybe outside the RU control.

gerhardol avatar Dec 18 '19 21:12 gerhardol

There is no need to add an account. Just rotate the screen when the dialog exists. image

After the rotation, the dialog will disappear and the stack trace above can be seen with logcat.

anlalalu avatar Dec 19 '19 08:12 anlalalu

Found it Most of the working accounts do not have this popup but a oauth setup.

A similar problem can occur in for instance add manual activity too. Total about 40 occasions. The issue itself can be fixed, not sure if this introduces any other problems. Without anyone reviewing I will be hesitant to change this (and to add a global variable without any other reason seem like a direction in the wrong direction), it is a quite big change too to change everything.

This did not occur when orientation was always locked to portrait....

gerhardol avatar Dec 19 '19 21:12 gerhardol

The solution seem to be to use DialogFragments instead. Quite some code to change - will also have to be changed in the android-x migration...

https://stackoverflow.com/questions/7557265/prevent-dialog-dismissal-on-screen-rotation-in-android

gerhardol avatar Dec 22 '19 23:12 gerhardol

Yes, that's it.

anlalalu avatar Dec 23 '19 03:12 anlalalu