yoshistabber / anymemo

Automatically exported from code.google.com/p/anymemo
GNU General Public License v2.0
0 stars 0 forks source link

Rotating device while loading items from network crashed the application #310

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open the Application
2. Click on "Open" tab
3. Click on "anymemo.org"
4. Rotate device while loading list from internet (requires slow internet 
connection otherwise the contents are loaded quickly)

What is the expected output? What do you see instead?
Application crashed with following exception

Exception Stack Trace:
Process: org.liberty.android.fantastischmemo, PID: 21440
java.lang.IllegalArgumentException: 
View=com.android.internal.policy.impl.PhoneWindow$DecorView{41f14088 V.E..... 
R.....ID 0,0-1160,324} not attached to window manager
    at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:370)
    at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:299)
    at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:84)
    at android.app.Dialog.dismissDialog(Dialog.java:329)
    at android.app.Dialog.dismiss(Dialog.java:312)
    at org.liberty.android.fantastischmemo.downloader.DownloaderAnyMemo$2$1.run(DownloaderAnyMemo.java:107)
    at android.os.Handler.handleCallback(Handler.java:759)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:5013)
    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:777)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
    at dalvik.system.NativeStart.main(Native Method)

Fix:
quick fix would be to check if the enclosing Activity instance is not destroyed 
before calling mProgressDialog.dismiss().

Note: 
This issue is present in all the asynchronous task that are executed in 
DownloaderAnyMemo class.
For all of them a background thread is started and when it finishes, it does 
not check whether the enclosing activity is still alive.

What is the AnyMemo version (E.g 8.999.1, 9.0, 9.1.1)?
10.2.993

What is your Android phone model?
Nexus 10

What is your Android version?
4.4

Original issue reported on code.google.com by Hegn...@gmail.com on 1 Apr 2014 at 1:49

GoogleCodeExporter commented 8 years ago
Yes, this is a current known issue. AnyMemo rely on a deprecated feature in 
Android to handle rotation. Android 4.3+ apparently removed it. So rotating 
screen while download will result in crash.

In AnyMemo 10.4, the import/export part has used new notification to do things 
and will handle rotation correctly. I will use the notification for download 
too.

Original comment by mrlhwlib...@gmail.com on 2 Apr 2014 at 4:39