Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14225] Android: ListView templates crash when a view is removed and added again (Alloy 1.2)

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-07-09T18:35:30.000+0000
Affected Version/sRelease 3.1.0
Fix Version/s2013 Sprint 15 API, 2013 Sprint 15, Release 3.1.2, Release 3.2.0
ComponentsAndroid
Labelslistview, parity, qe-closed-3.1.2, qe-testadded
ReporterNeville Dastur
AssigneeHieu Pham
Created2013-06-01T15:37:10.000+0000
Updated2013-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)

Comments

  1. Neville Dastur 2013-06-04

    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
  2. Daniel Sefton 2013-06-04

    I related them because they're both using the same test case.
  3. Neville Dastur 2013-06-04

    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.
  4. Clinton Robinson 2013-06-11

    There is a missing null check in the setTemplateType, should check to see is listItemData != null before accessing it.
  5. Neville Dastur 2013-06-11

    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.
  6. Clinton Robinson 2013-06-11

    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.
  7. Neville Dastur 2013-06-22

    Assuming this has now been confirmed. Is there a fix priority for this and an estimated fix release. Thanks
  8. Fauzi Assegaff 2013-07-08

    I second this issue, any updates on this fix would appreciated. thanks.
  9. Hieu Pham 2013-07-09

    This should be fixed with latest master.
  10. Hieu Pham 2013-07-25

  11. Neville Dastur 2013-07-26

    Tested on Galaxy S3 with master and can confirm the issue is fixed. Thank you.
  12. Olga Romero 2013-08-15

    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

JSON Source