[TIMOB-14225] Android: ListView templates crash when a view is removed and added again (Alloy 1.2)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-07-09T18:35:30.000+0000 |
Affected Version/s | Release 3.1.0 |
Fix Version/s | 2013 Sprint 15 API, 2013 Sprint 15, Release 3.1.2, Release 3.2.0 |
Components | Android |
Labels | listview, parity, qe-closed-3.1.2, qe-testadded |
Reporter | Neville Dastur |
Assignee | Hieu Pham |
Created | 2013-06-01T15:37:10.000+0000 |
Updated | 2013-08-21T08:43:04.000+0000 |
Description
*Problem*
Using alloy listview templates on Android seems to cause a crash when a view is removed and then added again. Works on iOS.
*Test case*
As alloy involves multiple files rather than a single app.js I have placed example code in our public github repo [https://github.com/ClinicalSoftwareSolutions/DemoBug/tree/listview_android_crash]
*Steps to reproduce*
Click on any row, which will show view2, then click the close button. On iOS you can switch between views no problem. On android closing the second view results in a crash.
*Note*
I am using Alloy 1.2 from git source to compile the alloy app, but I don't think that is the issue as the resulting Resources files seem fine.
*Log*
06-01 16:14:55.170: E/TiApplication(16676): (main) [675396,713363] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 3.1.0,2013/04/15 18:46,57634ef
06-01 16:14:55.170: E/TiApplication(16676): java.lang.NullPointerException
06-01 16:14:55.170: E/TiApplication(16676): at ti.modules.titanium.ui.widget.listview.ListSectionProxy.setTemplateType(ListSectionProxy.java:733)
06-01 16:14:55.170: E/TiApplication(16676): at ti.modules.titanium.ui.widget.listview.TiListView.processSection(TiListView.java:405)
06-01 16:14:55.170: E/TiApplication(16676): at ti.modules.titanium.ui.widget.listview.TiListView.processSections(TiListView.java:387)
06-01 16:14:55.170: E/TiApplication(16676): at ti.modules.titanium.ui.widget.listview.TiListView.processProperties(TiListView.java:301)
06-01 16:14:55.170: E/TiApplication(16676): at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1123)
06-01 16:14:55.170: E/TiApplication(16676): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:469)
06-01 16:14:55.170: E/TiApplication(16676): at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:453)
06-01 16:14:55.170: E/TiApplication(16676): at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:421)
06-01 16:14:55.170: E/TiApplication(16676): at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:434)
06-01 16:14:55.170: E/TiApplication(16676): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:485)
06-01 16:14:55.170: E/TiApplication(16676): at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:453)
06-01 16:14:55.170: E/TiApplication(16676): at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:421)
06-01 16:14:55.170: E/TiApplication(16676): at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:434)
06-01 16:14:55.170: E/TiApplication(16676): at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:569)
06-01 16:14:55.170: E/TiApplication(16676): at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:214)
06-01 16:14:55.170: E/TiApplication(16676): at android.os.Handler.dispatchMessage(Handler.java:95)
06-01 16:14:55.170: E/TiApplication(16676): at android.os.Looper.loop(Looper.java:137)
06-01 16:14:55.170: E/TiApplication(16676): at android.app.ActivityThread.main(ActivityThread.java:4898)
06-01 16:14:55.170: E/TiApplication(16676): at java.lang.reflect.Method.invokeNative(Native Method)
06-01 16:14:55.170: E/TiApplication(16676): at java.lang.reflect.Method.invoke(Method.java:511)
06-01 16:14:55.170: E/TiApplication(16676): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
06-01 16:14:55.170: E/TiApplication(16676): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
06-01 16:14:55.170: E/TiApplication(16676): at dalvik.system.NativeStart.main(Native Method)
I see that the issue has been marked as related to TC-2397. I don't think this is the case. Setting the accessoryType makes no difference
I related them because they're both using the same test case.
Okay, I just didn't want someone thinking that the bugs were related from the point of view of the behaviour described. I think it might be confusing. But will be clear now, I'm sure.
There is a missing null check in the setTemplateType, should check to see is listItemData != null before accessing it.
There should obviously be the null check, but presumably the pointer is becoming deallocated somewhere too as on initial loading the listview shows and only on reload does the null pointer exception occur.
This is a good point. At least for now I can continue to dev my project with this fix. There is def a deeper underlying problem to fix.
Assuming this has now been confirmed. Is there a fix priority for this and an estimated fix release. Thanks
I second this issue, any updates on this fix would appreciated. thanks.
This should be fixed with latest master.
Tested on Galaxy S3 with master and can confirm the issue is fixed. Thank you.
Tested and verified fix with: Titanium Studio, build: 3.1.2.201308091617 Titanium SDK, build: 3.1.2.v20130814124556 Alloy: 1.2.0-beta CLI: 3.1.2-alpha Device: Galaxy S4 Android version 4.2.2