{ "id": "62101", "key": "TIMOB-1469", "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": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-04-15T02:53:43.000+0000", "created": "2011-04-15T02:53:42.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "createtableviewsection", "headerview", "ios", "simulator" ], "versions": [], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-09T21:25:40.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": "{html}

When I want a tableView with my own custom styled section\nheaders, using the tableViewSection.headerView property with a\ncustom view opened in a new window, the app causes the cpu usage of\nmy (new) macbook pro to increase to 100% indicating some sort of\ninfinite loop or whatever when trying to render.

\n

The weird thing is that exactly the same code which causes this\nissue doesn't cause any problems when I don't use it in a separate\n.js file which is opened in a new window.

\n

bug.js

\n
\nvar win = Ti.UI.currentWindow;\nvar tableView = Ti.UI.createTableView({ data:[] });\nwin.add(tableView);\nvar newData = [];\nvar row = Titanium.UI.createTableViewRow({});\nvar lbl = Titanium.UI.createLabel({text: 'this is a test', height:'auto', top:10, left:10, right:10, color:'#000'});\nrow.add(lbl);\nrow.className = 'test';\nvar section = Titanium.UI.createTableViewSection({});\nvar headerViewRows = Titanium.UI.createView({height:30, width:'auto'});\nvar headerLabel = Titanium.UI.createLabel({text: 'this is a test header text', height:'auto', top:10, left:10, right:10, color:'#000'});\nheaderViewRows.add(headerLabel);\nsection.headerView = headerViewRows;  // uncommenting this line will cause the cpu to go wayyy up, not using custom headerview will work as expected\nsection.add(row);\nsection.headerTitle = 'test header title';\nnewData.push(section);\ntableView.data = newData;  // no difference between using data = ... or using setData()\n
\n

I also tried every variant of properties I could come up with\nfor the headerLabel, and the headerViewRows, all did not change\nanything. The view can be created without any explicitly set\nproperties and even without the label added, and no properties for\nthe section change anything either.

\n

Now for the issue: If you create a new project\nand just use the code above in the 'win1', adding the tableView to\nthe win1 object, everything works correctly. But if you would use\nthis as a separate file (bug.js), using the 'url' property of a new\nwindow opened from the win1 (by adding a click event listener to\nthe label) like this: app.js (of a newly created default\nproject):

\n
\nlabel1.addEventListener('click', function(e){\n    var newWin = Ti.UI.createWindow({\n        url:'bug.js'\n    });\n    newWin.open({fullscreen:false});\n});\n
\n

... causes the cpu to run to its max and sort of freezes the\napp. (iphone simulator 4)

\n

Now for some extra weirdness: commenting the line which sets the\nheaderView property of the section object will not cause this\ncpu-overload.

\n

I would really like to know why this happens, what I am doing\nwrong or how to fix this behaviour.

\n

extra maybe related info: I also noticed the\nfollowing: When I add a 'touchend' eventListener to the tableView\nand log some line in the event, it will output this line infinitely\nfrom the moment the window is opened, like it is continuously being\ncalled.

\n

btw. this is all on the latest 1.4.0 mobilesdk, titanium\ndeveloper 1.2.1, iphone sdk 4.0 (latest 4.0.1 xcode)

\n

\nlink to the post in the community forum (same content)

{html}", "attachment": [], "flagged": false, "summary": "cpu overload when using tableViewSection.headerView in new window (iphone simulator)", "creator": { "name": "victor", "key": "victor", "displayName": "Victor", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "victor", "key": "victor", "displayName": "Victor", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "125781", "author": { "name": "victor", "key": "victor", "displayName": "Victor", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

has anyone seen this issue? It would be nice to know what I\nmight try as a workaround...
\nanyway, good luck with all the work (I don't mean to pressure you\nguys, I love Titanium)

{html}", "updateAuthor": { "name": "victor", "key": "victor", "displayName": "Victor", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:53:42.000+0000", "updated": "2011-04-15T02:53:42.000+0000" }, { "id": "125782", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Unable to reproduce, 1.6.0RC1 (no CPU spike or deadlock). Never\nobserved this behavior in KS in previous versions. Going to mark\ninvalid.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:53:43.000+0000", "updated": "2011-04-15T02:53:43.000+0000" }, { "id": "410564", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-09T21:25:40.000+0000", "updated": "2017-03-09T21:25:40.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }