meonwax / soundboard

Soundboard for Android devices
GNU General Public License v3.0
25 stars 7 forks source link

dialog disappears after rotation #13

Open anlalalu opened 4 years ago

anlalalu commented 4 years ago
Reproduction Steps
  1. tap 'remove all sounds'
  2. rotate the screen
Result

The dialog disappears with the stack trace:

E/WindowManager: android.view.WindowLeaked: Activity de.meonwax.soundboard.activity.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{528bb8f0 V.E..... R.....I. 0,0-768,293} 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 android.support.v7.app.AlertDialog$Builder.show(AlertDialog.java:918) at de.meonwax.soundboard.activity.MainActivity.removeAll(MainActivity.java:212) at de.meonwax.soundboard.activity.MainActivity.onOptionsItemSelected(MainActivity.java:138) at android.app.Activity.onMenuItemSelected(Activity.java:2600) at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:404) at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:185) at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:100) at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:100) at android.support.v7.app.ToolbarActionBar$2.onMenuItemClick(ToolbarActionBar.java:69) at android.support.v7.widget.Toolbar$1.onMenuItemClick(Toolbar.java:169) at android.support.v7.widget.ActionMenuView$MenuBuilderCallback.onMenuItemSelected(ActionMenuView.java:760) at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:811) at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152) at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:958) at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:948) at android.support.v7.widget.ActionMenuView.invokeItem(ActionMenuView.java:618) at android.support.v7.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:139) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18422) 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 = 0.9.3

Android Version = 4.4.4

anlalalu commented 4 years ago

The issue can also be reproduced in Android 7.1.0 and may be solved with reference to this: https://stackoverflow.com/questions/2850573/activity-has-leaked-window-that-was-originally-added

Do you consider this as a defect?