catch IllegalArgumentException when dialog disappears before dismiss
It seems that sometimes checking dialog.isShowing() is not enough. I got a crash on dialog.dismiss(). But since the dialog is already gone in that case, just catch the Exception and move on. Here's the stacktrace: 31760 FDroid D Update took 45 seconds. 31760 FDroid D Invalidating preference 'lastUpdateCheck'. 31760 AndroidRuntime D Shutting down VM 31760 AndroidRuntime E FATAL EXCEPTION: main 31760 AndroidRuntime E java.lang.IllegalArgumentException: View not attached to window manager 31760 AndroidRuntime E at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:378) 31760 AndroidRuntime E at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:223) 31760 AndroidRuntime E at android.view.Window$LocalWindowManager.removeView(Window.java:432) 31760 AndroidRuntime E at android.app.Dialog.dismissDialog(Dialog.java:278) 31760 AndroidRuntime E at android.app.Dialog.access$000(Dialog.java:71) 31760 AndroidRuntime E at android.app.Dialog$1.run(Dialog.java:111) 31760 AndroidRuntime E at android.app.Dialog.dismiss(Dialog.java:268) 31760 AndroidRuntime E at org.fdroid.fdroid.UpdateService$UpdateReceiver.onReceiveResult(UpdateService.java:124) 31760 AndroidRuntime E at android.os.ResultReceiver$MyRunnable.run(ResultReceiver.java:43) 31760 AndroidRuntime E at android.os.Handler.handleCallback(Handler.java:587) 31760 AndroidRuntime E at android.os.Handler.dispatchMessage(Handler.java:92) 31760 AndroidRuntime E at android.os.Looper.loop(Looper.java:130) 31760 AndroidRuntime E at android.app.ActivityThread.main(ActivityThread.java:3687) 31760 AndroidRuntime E at java.lang.reflect.Method.invokeNative(Native Method) 31760 AndroidRuntime E at java.lang.reflect.Method.invoke(Method.java:507) 31760 AndroidRuntime E at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842) 31760 AndroidRuntime E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 31760 AndroidRuntime E at dalvik.system.NativeStart.main(Native Method) 119 E Dumpstate > /data/log/dumpstate_app_error 119 ActivityManager W Force finishing activity org.fdroid.fdroid/.views.RepoDetailsActivity more info: https://stackoverflow.com/questions/19538282/view-not-attached-to-window-manager-dialog-dismiss
This commit is contained in:
parent
615bcfb666
commit
57435aa6b6
@ -120,7 +120,13 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
}
|
||||
|
||||
if (finished && dialog.isShowing())
|
||||
dialog.dismiss();
|
||||
try {
|
||||
dialog.dismiss();
|
||||
} catch (IllegalArgumentException e) {
|
||||
// sometimes dialog.isShowing() doesn't work :(
|
||||
// https://stackoverflow.com/questions/19538282/view-not-attached-to-window-manager-dialog-dismiss
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user