Project: titanium
Issue TIMOB-23333: Android: Attempt to invoke virtual method 'void android.view.OrientationEventListener.disable()' on a null object reference Crash
We get the following crash frequently: java.lang.RuntimeException: Unable to destroy activity {com.myapp/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.OrientationEventListener.disable()' on a null object reference at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3821) at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3839) at android.app.ActivityThread.access$1400(ActivityThread.java:162) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1403) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5431) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.OrientationEventListener.disable()' on a null object reference at org.appcelerator.titanium.TiBaseActivity.onDestroy(TiBaseActivity.java:1477) at org.appcelerator.titanium.TiActivity.onDestroy(TiActivity.java:29) at android.app.Activity.performDestroy(Activity.java:6235) at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1141) at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3808) ... 10 more It is happening when android os terminates app to save memory at onDestroy method. (This happens quite a lot since our users usually keep app open for long periods) This is not happening at 4.0 sdk (we got those after upgrading from 4.0 to 5.2.2) After searching changes history this change seems to have caused this behavior : https://github.com/appcelerator/titanium_mobile/commit/2b12ad61775920f8045e168ae678ce123dfa14b4 seems to have caused the issue
Story points: 2