{ "id": "62577", "key": "TIMOB-1945", "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": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:57:37.000+0000", "created": "2011-04-15T03:06:16.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "android", "defect" ], "versions": [], "issuelinks": [], "assignee": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2011-04-17T01:57:37.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

Using this failcase app.js, tap very quickly from one tab to\nanother. If you do it fast enough, you will cause a crash:

\n
\n\nTitanium.UI.setBackgroundColor('#000');\n\nvar table;\n\nfunction updateTable() {\n    Ti.API.info('updateTable');\n    var rowcount = ((Math.floor(Math.random() * 10)) % 2 === 0) ? 5 : 500;\n    var rows = [];\n    table.data = [];\n    for (var i = 0; i < rowcount; i++) {\n        var tr = Ti.UI.createTableViewRow();\n        tr.leftImage = 'KS_nav_ui.png';\n        tr.title = \"Row \" + i;\n        rows.push(tr);\n    }\n    table.data = rows;\n}\n\nvar tabGroup = Titanium.UI.createTabGroup();\ntabGroup.addEventListener('focus', function(e)\n{\n    updateTable();\n});\n\n\nvar win1 = Titanium.UI.createWindow({  \n    title:'Tab 1',\n    backgroundColor:'#fff'\n});\nvar tab1 = Titanium.UI.createTab({  \n    icon:'KS_nav_views.png',\n    title:'Tab 1',\n    window:win1\n});\n\ntable = Ti.UI.createTableView();\nwin1.add(table);\n\nvar win2 = Titanium.UI.createWindow({  \n    title:'Tab 2',\n    backgroundColor:'#fff'\n});\nvar tab2 = Titanium.UI.createTab({  \n    icon:'KS_nav_ui.png',\n    title:'Tab 2',\n    window:win2\n});\n\ntabGroup.addTab(tab1);  \ntabGroup.addTab(tab2);  \ntabGroup.open();\n
\n

The problem appears to be that .setData is not\nthread safe. It can be called in quick succession from different\nthreads. While one of the threads is in the part of the method that\ncalls updateView(), the other thread can \"pull the\ndata out from underneath it\", so to speak, by calling\n.setData again.

{html}", "attachment": [], "flagged": false, "summary": "Android: tableview .setData while view being assembled can cause IndexOutOfBoundsException", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "127058", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

(from [d398c65d1f3fbd322582ec0441b0ba0f254bb472])\n[#1945 state:fixed-in-qa] Synchronize methods\nthat both insert/delete rows (or replace the row data completely)\nand call updateView, so that the data cannot be again changed while\nupdateView is still running. \nhttp://github.com/appcelerator/titanium_mobile/commit/d398c65d1f3fb...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:06:16.000+0000", "updated": "2011-04-15T03:06:16.000+0000" }, { "id": "127059", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

1.4.2.4ce7ff G1 running 1.6, 2.2 simulator

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:06:16.000+0000", "updated": "2011-04-15T03:06:16.000+0000" }, { "id": "127060", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Ti Mobile sdk 1.5.0.02c264

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:06:16.000+0000", "updated": "2011-04-15T03:06:16.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }