{ "id": "171854", "key": "TIMOB-26164", "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": "20238", "description": "", "name": "Release 7.5.0", "archived": false, "released": true, "releaseDate": "2018-11-15" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-08-24T17:23:49.000+0000", "created": "2018-06-28T07:21:11.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "alloy", "run-on-main-thread", "tableview", "tableviewrow", "titanium" ], "versions": [ { "id": "20102", "name": "Release 7.1.1", "archived": false, "released": true, "releaseDate": "2018-05-02" }, { "id": "20099", "name": "Release 7.2.0", "archived": false, "released": true, "releaseDate": "2018-06-14" } ], "issuelinks": [], "assignee": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-08-24T17:23:57.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": "When enabling\r\n{code:java}\r\ntrue\r\n{code}\r\nand using TableView, if one runs insertRowAfter directly after updateRow the app will throw the error below or cause race crash with no error.\r\n\r\nError: \r\n{code:java}\r\n[ERROR] Script Error {\r\n[ERROR] column = 27;\r\n[ERROR] line = 90;\r\n[ERROR] message = \"Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (20) must be equal to the number of rows contained in that section before the update (20), plus or minus the number of rows inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).\";\r\n{code}\r\n\r\nSteps to reproduce:\r\n1. Create new alloy project\r\n2. In your index.js add the code below\r\n3. Build to ios simlulator\r\n5. Click on \"Update + Add\" button\r\n7. Remove run-on-main-thread from tiapp.xml and build and see that everything works fine.\r\n\r\nPS....when adding the setTimeout you will see that it works\r\n{code:java}\r\nvar rowData = [];\r\n\r\nfor (var i=0; i<20; i++){\r\n\r\n\tvar row = Ti.UI.createTableViewRow({\r\n\t height: \"50dp\",\r\n\t width:\tTi.UI.FILL,\r\n\t title: \"row\" + i,\r\n\t});\t\r\n\r\n\trowData.push(row);\r\n\r\n};\r\n\r\nvar tableView = Ti.UI.createTableView({\r\n \tdata:rowData,\r\n \tbottom: 50,\r\n});\r\n\r\n$.index.add(tableView);\r\n\r\nvar button = Titanium.UI.createButton({\r\n\ttitle: 'Update + Add',\r\n\tbottom: 10,\r\n\theight: 50,\r\n});\r\n\r\nbutton.addEventListener('click',function(){\r\n\t\t\r\n\tvar updatedRow = Ti.UI.createTableViewRow({\r\n\t height: \"50dp\",\r\n\t width:\tTi.UI.FILL,\r\n\t title: \"updatedRow\",\r\n\t});\r\n\ttableView.updateRow(0,updatedRow);\r\n\t\t\r\n\t//setTimeout(function(){ // uncomment to see it working with a delay\r\n\tvar newRow = Ti.UI.createTableViewRow({\r\n\t height: '50dp',\r\n\t width:\tTi.UI.FILL,\r\n\t title: \"newRow\",\r\n\t});\r\n\ttableView.insertRowAfter(0,newRow);\r\n\t//}, 500);\r\n});\r\n\r\n$.index.add(button);\r\n\t \r\n$.index.open();\r\n{code}\r\n\r\n", "attachment": [], "flagged": false, "summary": "iOS: TableView + run-on-main-thread - insertRowAfter directly after updateRow causes error / race crash", "creator": { "name": "dieskim", "key": "dieskim", "displayName": "David van de Meer", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "dieskim", "key": "dieskim", "displayName": "David van de Meer", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Operating System\r\nName = Mac OS X\r\nVersion = 10.13.2\r\nArchitecture = 64bit\r\n\r\nCPUs = 8\r\nMemory = 17179869184\r\nNode.js\r\nNode.js Version = 8.1.2\r\nnpm Version = 3.10.10\r\nTitanium CLI\r\nCLI Version = 5.1.0\r\nTitanium SDK\r\nSDK Version = 7.2.0.GA\r\nSDK Path = /Users/user/Library/Application Support/Titanium/mobilesdk/osx/7.2.0.GA\r\nTarget Platform = iphone", "closedSprints": [ { "id": 1065, "state": "closed", "name": "2016 Sprint 17 SDK", "startDate": "2018-08-13T17:39:36.846Z", "endDate": "2018-08-27T17:39:00.000Z", "completeDate": "2018-08-29T16:10:57.013Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "438805", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Test Case -\r\n\r\n\r\n{code:java}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: 'white'\r\n});\r\nvar rowData = [];\r\n \r\nfor (var i=0; i<20; i++){\r\n \r\n\tvar row = Ti.UI.createTableViewRow({\r\n\t height: \"50dp\",\r\n\t width:\tTi.UI.FILL,\r\n\t title: \"row\" + i,\r\n\t});\t\r\n \r\n\trowData.push(row);\r\n \r\n};\r\n \r\nvar tableView = Ti.UI.createTableView({\r\n \tdata:rowData,\r\n \tbottom: 50,\r\n});\r\n \r\nwin.add(tableView);\r\n \r\nvar button = Titanium.UI.createButton({\r\n\ttitle: 'Update + Add',\r\n\tbottom: 10,\r\n\theight: 50,\r\n});\r\n \r\nbutton.addEventListener('click',function(){\r\n\t\t\r\n\tvar updatedRow = Ti.UI.createTableViewRow({\r\n\t height: \"50dp\",\r\n\t width:\tTi.UI.FILL,\r\n\t title: \"updatedRow\",\r\n\t});\r\n\ttableView.updateRow(0,updatedRow);\r\n\t\t\r\n\t//setTimeout(function(){ // uncomment to see it working with a delay\r\n\tvar newRow = Ti.UI.createTableViewRow({\r\n\t height: '50dp',\r\n\t width:\tTi.UI.FILL,\r\n\t title: \"newRow\",\r\n\t});\r\n\ttableView.insertRowAfter(0,newRow);\r\n\t//}, 500);\r\n});\r\n \r\nwin.add(button);\r\n\t \r\nwin.open();\r\n{code}", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-06-28T07:51:54.000+0000", "updated": "2018-06-28T07:51:54.000+0000" }, { "id": "438811", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR : https://github.com/appcelerator/titanium_mobile/pull/10140", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-06-28T09:12:21.000+0000", "updated": "2018-06-28T09:12:21.000+0000" }, { "id": "438854", "author": { "name": "dieskim", "key": "dieskim", "displayName": "David van de Meer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Confirmed working on my patched SDK", "updateAuthor": { "name": "dieskim", "key": "dieskim", "displayName": "David van de Meer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-06-29T03:24:29.000+0000", "updated": "2018-06-29T03:24:29.000+0000" }, { "id": "439312", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket*, Verified fix in SDK Version: {{7.4.0.v20180717131401}}\r\n\r\n*FR Passed (Test Steps):*\r\n# Created a titanium Application\r\n# Added the following code above in to the {{app.js}}\r\n# Ran the program\r\n# Pressed \"Update + Add\"\r\n# Application no longer crashes un like in 7.2.0.GA\r\n\r\n*Test Environment*\r\n{code:java}\r\nAPPC Studio: 5.0.0.201712081732\r\nAPPC CLI: 7.0.4\r\niPhone 6 simulator (11.2)\r\nOperating System Name: Mac OS High Sierra\r\nOperating System Version: 10.13\r\nNode.js Version: 8.9.1\r\nXcode 9.2\r\n{code}\r\n", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-07-18T18:58:16.000+0000", "updated": "2018-07-18T18:58:16.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }