What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

App version: 1.0.31/1.0.35/1.0.52
Device: Nexus 7
Problem: When you rotate the screen while passing a comment the app will crash. The comment is still posted, even though the app does crash.
LOGCAT:

04-27 01:59:20.562 E/AndroidRuntime(17551): FATAL EXCEPTION: main
04-27 01:59:20.562 E/AndroidRuntime(17551): java.lang.IllegalArgumentException: View not attached to window manager
04-27 01:59:20.562 E/AndroidRuntime(17551):     at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:406)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:308)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:79)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at android.app.Dialog.dismissDialog(Dialog.java:323)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at android.app.Dialog.dismiss(Dialog.java:306)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at com.stackexchange.marvin.core.OperationThatCanFail$1.onPostExecute(OperationThatCanFail.java:81)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at com.stackexchange.marvin.core.OperationThatCanFail$1.onPostExecute(OperationThatCanFail.java:67)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at android.os.AsyncTask.finish(AsyncTask.java:631)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at android.os.AsyncTask.access$600(AsyncTask.java:177)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at android.os.Looper.loop(Looper.java:137)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at android.app.ActivityThread.main(ActivityThread.java:5103)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at java.lang.reflect.Method.invokeNative(Native Method)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at java.lang.reflect.Method.invoke(Method.java:525)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126)
04-27 01:59:20.562 E/AndroidRuntime(17551):     at dalvik.system.NativeStart.main(Native Method)
share|improve this question
4  
at com.stackexchange.marvin.core.OperationThatCanFail$1.onPostExecute(OperationThat‌​CanFail.java:81) rofl, I think they meant for the app to crash on that. ;) –  hichris123 Apr 27 at 1:40
    
The title doesn't match the content of your question (question vs. comment). –  A.L Apr 27 at 3:09
    
Do you use the default Android keyboard? –  A.L Apr 27 at 3:10
    
Yes I do use the default keyboard –  Howli Apr 27 at 8:59
    
This is still happening in version 1.0.35. The comment is still posted even with the crash happening. –  Howli May 20 at 23:55
    
Testing to see if this happens...and it does still happen, but still posted the comment. –  Howli Dec 21 at 12:46
1  
Repro'd on Nexus 4, 5.0.1 Lollipop, app v1.0.52. Looking from onPostExecute, it must be using AsyncTask, and yes, this must be handled carefully if there is configuration change (e.g. orientation change) since the app might lose the reference to the task and crash. –  Andrew T. Dec 21 at 15:30

1 Answer 1

Thanks for reporting this! Sorry it took so long to fix, but it's fixed as of the next beta update (version 1.0.53+).

Technical details: Oh the irony of OperationThatCanFail causing a crash... here's the diff on onPostExecute:

             protected void onPostExecute(Exception e) {
+                if (fragment != null) {
+                    fragment.removeDependentAsyncTask(this);
+                    if (fragment.isDetached())
+                        return;
+                }
                 if (mDia != null && mDia.isShowing())
                     mDia.dismiss();
-                if (fragment != null)
-                    fragment.removeDependentAsyncTask(this);
                 if (isCancelled())
                     return;
                 if (e != null) { onFailure(e); } else { onSuccess(); }
             }

A fragment being "detached" (removed from the window manager) automatically removes all the children views in it from the manager so we needed to check if it was detached before trying to kill the status indicator pop-up.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .