{ "id": "125001", "key": "TIMOB-16431", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2016-04-27T10:37:14.000+0000", "created": "2014-01-18T18:03:50.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "ios", "listitem", "listview" ], "versions": [ { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "issuelinks": [], "assignee": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-04-27T10:37:38.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "App (iOS & Android) crashes when clickHandler of ListView updates ListItem when list being displayed as Search Result.\r\n\r\nTo reproduce the error:\r\n1. add the following code to list_v2_search_searchview.js of Kitchen Sink:\r\n{code}\r\n e.section.updateItemAt(e.itemIndex, {\r\n properties: { title: 'Will crash app' }\r\n });\r\n{code}\r\n\r\n2. do a search (with result)\r\n3. click on any row of the search result (list view)\r\n4. *app crash*\r\n\r\nModified Kitchen Sink code:\r\n{code:title=list_v2_search_searchview.js}\r\n\r\nfunction clickHandler(e){\r\n var message = 'Type:'+e.type+'\\nSection title:'+e.section.headerTitle+'\\nsectionIndex:'+e.sectionIndex+'\\nitemIndex:'+e.itemIndex;\r\n if(isValidVar(e.bindId)){\r\n message += '\\nbindId:'+e.bindId;\r\n }\r\n if(isValidVar(e.itemId)){\r\n message += '\\nitemId:'+e.itemId;\r\n }\r\n alert(message);\r\n\r\n e.section.updateItemAt(e.itemIndex, {\r\n\t\tproperties: { title: 'Will crash app' }\r\n });\r\n}\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "iOS/Android: Updating ListItem of ListView displayed after Search crashes app", "creator": { "name": "youngtt", "key": "youngtt", "displayName": "Young", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "youngtt", "key": "youngtt", "displayName": "Young", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Ti SDK 3.2.0GA, iOS and Android", "comment": { "comments": [ { "id": "288819", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "I tested this issue with the test code below. I can't reproduce this issue. Can you please do a quick test using the code below to see if you can reproduce the error. If so, please let us know.\r\n\r\n\r\nh5. Test Environment\r\nMac OX S 10.8.5\r\nTi SDK 3.2.0.GA\r\nTi CLI 3.2.0 \r\nIOS simulator 7.0.3\r\n\r\nh5. Test Code\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'white',\r\n\tfullscreen : true\r\n});\r\n\r\nvar search = Titanium.UI.createSearchBar({\r\n\tbarColor : '#000',\r\n\tshowCancel : true,\r\n\theight : 43,\r\n\ttop : 0,\r\n});\r\nsearch.addEventListener('cancel', function() {\r\n\tsearch.blur();\r\n});\r\n\r\nvar listView = Ti.UI.createListView({\r\n\tsearchView : search,\r\n\tcaseInsensitiveSearch : true\r\n});\r\n\r\nvar listSection = Ti.UI.createListSection();\r\nvar fruits = ['Papaya', 'Peach', 'Pear', 'Persimmon', 'Pineapple', 'Pluot', 'Pomegranate'];\r\nvar data = [];\r\nfor (var i = 0; i < fruits.length; i++) {\r\n\tdata.push({\r\n\t\tproperties : {\r\n\t\t\ttitle : fruits[i],\r\n\t\t\tsearchableText : fruits[i]\r\n\t\t}\r\n\t});\r\n}\r\nlistSection.setItems(data);\r\n\r\nlistView.addEventListener('itemclick', function(e) {\r\n\te.section.updateItemAt(e.itemIndex, {\r\n\t\tproperties : {\r\n\t\t\ttitle : 'Will crash app'+e.itemIndex\r\n\t\t}\r\n\t});\r\n});\r\n\r\nlistView.sections = [listSection];\r\nwin.add(listView);\r\nwin.open();\r\n{code}\r\n\r\nh5. Step to Test \r\n\r\n# Create a simple project \r\n# Update app.js with my test code \r\n# Run on iOS simulator for testing \r\n# Do a search (with result)\r\n# Click on any row of the search result (list view)\r\n\r\nh5. Test Result \r\n\r\nApp is running with out any crash \r\n\r\nThanks \r\n", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-01-20T14:10:50.000+0000", "updated": "2014-01-21T00:29:57.000+0000" }, { "id": "291420", "author": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "body": "I am experiencing the same issue.\nA simple project using Mostafizur Rahman's code also crashes as soon as I click an item in the search results. Code crashes in 3.2.0GA as well as 3.2.1.\n\nRan the project in XCode and the crash occurs in TiUIListview.m, on this line:\n-(void)buildResultsForSearchText\n{\n searchActive = ([searchString length] > 0); >> EXC_BAD_ACCESS\n\n\nI will try to hack fix it, but I hope you can find a real fix soon.", "updateAuthor": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-02-05T15:12:15.000+0000", "updated": "2014-02-05T15:12:15.000+0000" }, { "id": "292097", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Moving this ticket to engineering as I can reproduce this issue with the following test case on iOS platform. It appears related to TC-3682 (crash with deleteItemsAt) whereas this crash is with updateItemAt. \r\n\r\n{code}\r\nvar win=Ti.UI.createWindow({\r\n fullscreen:false\r\n});\r\nvar template={\r\n childTemplates:[\r\n {\r\n type:'Ti.UI.Label',\r\n bindId:'title'\r\n }\r\n ]\r\n};\r\nvar items=[];\r\nfor(var k=0;k<500;k++){\r\n items.push({\r\n properties:{\r\n searchableText:'Click to delete '+k\r\n },\r\n title:{text:'Click to delete '+k}\r\n });\r\n}\r\n \r\nvar search=Ti.UI.createSearchBar();\r\n \r\nvar listView=Ti.UI.createListView({\r\n templates:{template:template},\r\n defaultItemTemplate:'template',\r\n sections:[\r\n Ti.UI.createListSection({\r\n items:items\r\n })\r\n ],\r\n searchView:search\r\n});\r\n\r\nlistView.addEventListener('itemclick', function(e) {\r\n e.section.updateItemAt(e.itemIndex, {\r\n properties : {\r\n title : 'Will crash app'+e.itemIndex\r\n }\r\n });\r\n});\r\n \r\nlistView.addEventListener('itemclick',function(e){\r\n var index=e.itemIndex;\r\n Ti.API.info(\"Index\" + index);\r\n // e.section.deleteItemsAt(index,1);\r\n e.section.updateItemAt(e.itemIndex, {\r\n properties : {\r\n title : 'Will crash app' + e.itemIndex\r\n }\r\n });\r\n});\r\n\r\nwin.add(listView);\r\nwin.open();\r\n{code} ", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-09T07:45:05.000+0000", "updated": "2014-02-09T07:45:05.000+0000" }, { "id": "384062", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey guys, could you try using the latest 5.2.2.GA for this issue? I remember we fixed something related for that release. Thank you!\r\n\r\n*EDIT*: Using the below code (refactored from above), it does not crash when clicking an item while the search is focussed:\r\n\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow();\r\n\r\nvar template = {\r\n childTemplates: [\r\n {\r\n type: 'Ti.UI.Label',\r\n bindId: 'title'\r\n }\r\n ]\r\n};\r\n\r\nvar items = [];\r\n\r\nfor (var k = 0; k < 500; k++) {\r\n items.push({\r\n properties: {\r\n searchableText: 'Click to delete ' + k\r\n },\r\n title: {\r\n text: 'Click to delete ' + k\r\n }\r\n });\r\n}\r\n\r\nvar search = Ti.UI.createSearchBar();\r\nvar listView = Ti.UI.createListView({\r\n templates: {\r\n template: template\r\n },\r\n defaultItemTemplate: 'template',\r\n sections: [\r\n Ti.UI.createListSection({\r\n items: items\r\n })\r\n ],\r\n searchView: search\r\n});\r\n\r\nlistView.addEventListener('itemclick', function(e) {\r\n\r\n Ti.API.info(\"Index\" + e.itemIndex);\r\n\r\n e.section.updateItemAt(e.itemIndex, {\r\n properties: {\r\n\t\t\tsearchableText: 'Will crash app' + e.itemIndex\r\n },\r\n title: {\r\n text: 'Will crash app' + e.itemIndex\r\n }\r\n });\r\n});\r\n\r\nwin.add(listView);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-04-27T10:28:13.000+0000", "updated": "2016-04-27T10:36:54.000+0000" }, { "id": "384063", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Closing for now. If you still experience it, feel free to comment here!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-04-27T10:37:38.000+0000", "updated": "2016-04-27T10:37:38.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }