{ "id": "174523", "key": "TIMOB-27779", "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": "20950", "name": "Release 9.1.0", "archived": false, "released": true, "releaseDate": "2020-08-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-08-11T15:04:56.000+0000", "created": "2019-12-10T06:32:33.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "android", "hang", "tabbedbar" ], "versions": [ { "id": "19882", "name": "Release 8.0.0", "archived": false, "released": true, "releaseDate": "2019-03-14" } ], "issuelinks": [ { "id": "58290", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "174865", "key": "TIMOB-27826", "fields": { "summary": "Android: Unable to select tabs after setting \"labels\" via TabbedBar \"click\" (Parity)", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "rislam", "key": "rislam", "displayName": "Riduanul Islam", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-08-11T15:04:56.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": "*Steps to reproduce:*\r\n# Build and run the below code on Android.\r\n# Tap on one of the tabs.\r\n# Notice that the app hangs.\r\n\r\n{code:javascript}\r\nvar window = Ti.UI.createWindow();\r\nvar tabbedBar = Ti.UI.createTabbedBar();\r\ntabbedBar.labels = [\"One\", \"Two\", \"Three\"];\r\ntabbedBar.addEventListener(\"click\", function() {\r\n\tconsole.log(new Date() + \" tbrSortTLby Click event triggerred\");\r\n\ttabbedBar.labels = ['Three', 'Four', 'Five'];\r\n});\r\nwindow.add(tabbedBar);\r\nwindow.open();\r\n{code}\r\n\r\n*Cause:*\r\nSetting the \"labels\" property causes the \"click\" event to be fired. So, setting \"labels\" within a \"click\" event listener will cause infinite recursion to occur which will eventually cause a crash.\r\n\r\n*Work-Around:*\r\nDefer setting the \"labels\" property via {{setTimeout()}} within the \"click\" listener.\r\n", "attachment": [ { "id": "67192", "filename": "AndroidSandBox.zip", "author": { "name": "tlau", "key": "tlau", "displayName": "Tony Lau", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-12-28T09:22:31.000+0000", "size": 8669614, "mimeType": "application/zip" }, { "id": "67191", "filename": "AndroidTabbedBarTrace.log", "author": { "name": "tlau", "key": "tlau", "displayName": "Tony Lau", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-12-28T09:20:52.000+0000", "size": 334019, "mimeType": "text/plain" }, { "id": "67189", "filename": "Trace log pic.png", "author": { "name": "rislam", "key": "rislam", "displayName": "Riduanul Islam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-12-24T15:39:48.000+0000", "size": 45075, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Setting \"labels\" via TabbedBar \"click\" event hangs app", "creator": { "name": "tlau", "key": "tlau", "displayName": "Tony Lau", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "tlau", "key": "tlau", "displayName": "Tony Lau", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium SDK 8.3.0GA, Android Studio 3.5.3. Android 10.0 (Q) API level 29.", "closedSprints": [ { "id": 1201, "state": "closed", "name": "2020 Sprint 14", "startDate": "2020-07-06T15:40:00.000Z", "endDate": "2020-07-17T15:40:00.000Z", "completeDate": "2020-07-20T22:16:28.367Z", "originBoardId": 114 }, { "id": 1202, "state": "closed", "name": "2020 Sprint 15", "startDate": "2020-07-20T22:16:05.601Z", "endDate": "2020-07-31T22:16:00.000Z", "completeDate": "2020-08-03T20:27:12.585Z", "originBoardId": 114 }, { "id": 1203, "state": "closed", "name": "2020 Sprint 16", "startDate": "2020-08-03T20:57:55.114Z", "endDate": "2020-08-14T20:57:00.000Z", "completeDate": "2020-08-14T15:19:51.647Z", "originBoardId": 114 }, { "id": 1195, "state": "closed", "name": "2020 Sprint 10", "startDate": "2020-05-08T16:37:58.282Z", "endDate": "2020-05-22T16:37:00.000Z", "completeDate": "2020-05-21T15:26:11.089Z", "originBoardId": 114 }, { "id": 1196, "state": "closed", "name": "2020 Sprint 11", "startDate": "2020-05-26T15:56:00.000Z", "endDate": "2020-06-05T15:56:00.000Z", "completeDate": "2020-06-08T21:05:50.356Z", "originBoardId": 114 }, { "id": 1198, "state": "closed", "name": "2020 Sprint 12", "startDate": "2020-06-08T21:06:41.849Z", "endDate": "2020-06-19T21:06:00.000Z", "completeDate": "2020-06-19T15:54:38.493Z", "originBoardId": 114 }, { "id": 1199, "state": "closed", "name": "2020 Sprint 13", "startDate": "2020-06-19T16:41:04.099Z", "endDate": "2020-07-02T16:41:00.000Z", "completeDate": "2020-07-02T15:37:12.455Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "453268", "author": { "name": "rislam", "key": "rislam", "displayName": "Riduanul Islam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi, \r\nI've tested this issue in 3 different pattern but failed to reproduce this. \r\nCan you try this below code and help us to reproduce this: \r\n{code}\r\nvar window = Ti.UI.createWindow();\r\nvar tabbedBar = Ti.UI.createTabbedBar();\r\ntabbedBar.labels = [\"One\", \"Two\", \"Three\"];\r\nwindow.add(tabbedBar);\r\nwindow.open();\r\n{code}\r\nIf you have another reproducible steps, let us know the full steps with code, also provide us the full log from command line.\r\nMy Testing environments are following:\r\n{code}\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.14.6\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8589934592\r\n\r\nNode.js\r\n Node.js Version = 8.9.4\r\n npm Version = 6.5.0\r\n\r\nTitanium CLI\r\n CLI Version = 5.2.2\r\n\r\nTitanium SDK\r\n SDK Version = 8.3.0.GA\r\nDevice: Samsung Galaxy J7, android version-8.1.0\r\nTargeting Android SDK API: 29\r\n{code}", "updateAuthor": { "name": "rislam", "key": "rislam", "displayName": "Riduanul Islam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-12-20T17:54:36.000+0000", "updated": "2019-12-20T17:54:36.000+0000" }, { "id": "453285", "author": { "name": "tlau", "key": "tlau", "displayName": "Tony Lau", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The crash occur after the Window is opened with the tabbed bar displayed, and then try to change the labels in code.\r\n\r\ntabbedBar.labels = [\"Four\", \"Five\", \"Six\"];\r\n\r\n", "updateAuthor": { "name": "tlau", "key": "tlau", "displayName": "Tony Lau", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-12-23T07:45:31.000+0000", "updated": "2019-12-23T07:45:31.000+0000" }, { "id": "453302", "author": { "name": "rislam", "key": "rislam", "displayName": "Riduanul Islam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Tony Lau, \r\nCan you share complete trace log with us? \r\n\r\nSee this image below for details information: \r\n!Trace log pic.png|thumbnail! \r\n\r\nThanks.", "updateAuthor": { "name": "rislam", "key": "rislam", "displayName": "Riduanul Islam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-12-24T15:40:23.000+0000", "updated": "2019-12-24T15:40:23.000+0000" }, { "id": "453327", "author": { "name": "tlau", "key": "tlau", "displayName": "Tony Lau", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I created a new project AndroidSandBox and able to reproduce the repeat \"click\" issue.\r\n\r\nindex.html\r\n\r\n\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\r\n\r\n\r\n\r\nindex.js\r\nfunction tbrSortTLbyClicked() {\r\n\tTi.API.debug(new Date() + \" tbrSortTLby Click event triggerred\");\r\n\t$.tbrSortTLby.labels = ['Three','Four','Five'];\r\n\r\n};\r\n$.index.open();\r\n\r\nindex.tss\r\n\".container\": {\r\n\tbackgroundColor:\"white\"\r\n}\r\n\r\n\"Label\": {\r\n\twidth: Ti.UI.SIZE,\r\n\theight: Ti.UI.SIZE,\r\n\tcolor: \"#000\"\r\n}\r\n\r\n\"#label\": {\r\n\tfont: {\r\n\t\tfontSize: 12\r\n\t}\r\n}\r\n\r\n'#sortlistbar': {\r\n\ttop: '10%',\r\n\tbottom: '0%',\r\n\theight: '6%',\r\n\twidth: '98%',\r\n}\r\n\r\n'#tbrSortTLby': {\r\n\tleft: 0,\r\n\twidth: '85%',\r\n\tfont: {\r\n\t\tfontSize: '18dip'\r\n\t},\r\n\theight:Ti.UI.FILL,\r\n\tright: '5%'\r\n}\r\n\r\n\r\n", "updateAuthor": { "name": "tlau", "key": "tlau", "displayName": "Tony Lau", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-12-28T09:16:29.000+0000", "updated": "2019-12-28T09:16:29.000+0000" }, { "id": "453328", "author": { "name": "tlau", "key": "tlau", "displayName": "Tony Lau", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Click on any of the labels. e.g \"One\", the labels cahnged to \"Four\", \"Five\" and \"Six\" as expected but the trace log showed the click event is continuously triggered. Detail trace log and project code attached.\r\n\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[INFO] : chatty: uid=10088(u0_a88) com.mysandbox.android identical 6 lines\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[INFO] : zygote: Do partial code cache collection, code=29KB, data=22KB\r\n[INFO] : zygote: After code cache collection, code=29KB, data=22KB\r\n[INFO] : zygote: Increasing code cache capacity to 128KB\r\n\r\n\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[INFO] : chatty: uid=10088(u0_a88) com.mysandbox.android identical 1 line\r\n[DEBUG] : Sat Dec 28 2019 01:01:19 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:20 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[INFO] : chatty: uid=10088(u0_a88) com.mysandbox.android identical 7 lines\r\n[DEBUG] : Sat Dec 28 2019 01:01:20 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:20 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[INFO] : chatty: uid=10088(u0_a88) com.mysandbox.android identical 6 lines\r\n[DEBUG] : Sat Dec 28 2019 01:01:20 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[INFO] : zygote: Do partial code cache collection, code=61KB, data=42KB\r\n[INFO] : zygote: After code cache collection, code=61KB, data=42KB\r\n[INFO] : zygote: Increasing code cache capacity to 256KB\r\n[DEBUG] : Sat Dec 28 2019 01:01:20 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[INFO] : chatty: uid=10088(u0_a88) com.mysandbox.android identical 35 lines\r\n[DEBUG] : Sat Dec 28 2019 01:01:20 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:21 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[INFO] : chatty: uid=10088(u0_a88) com.mysandbox.android identical 26 lines\r\n[DEBUG] : Sat Dec 28 2019 01:01:21 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:21 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:21 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[INFO] : chatty: uid=10088(u0_a88) com.mysandbox.android identical 25 lines\r\n[DEBUG] : Sat Dec 28 2019 01:01:21 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:22 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[INFO] : chatty: uid=10088(u0_a88) com.mysandbox.android identical 43 lines\r\n[DEBUG] : Sat Dec 28 2019 01:01:22 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n[DEBUG] : Sat Dec 28 2019 01:01:22 GMT-0800 (PST) tbrSortTLby Click event triggerred\r\n\r\n ", "updateAuthor": { "name": "tlau", "key": "tlau", "displayName": "Tony Lau", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-12-28T09:20:00.000+0000", "updated": "2019-12-28T09:20:00.000+0000" }, { "id": "454307", "author": { "name": "tlau", "key": "tlau", "displayName": "Tony Lau", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Need more info? Hope this can be fixed in SDK 9", "updateAuthor": { "name": "tlau", "key": "tlau", "displayName": "Tony Lau", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-02-17T19:42:58.000+0000", "updated": "2020-02-17T19:42:58.000+0000" }, { "id": "454390", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Since you are setting new labels inside the click event I think it will trigger the event again because it is selecting the first new value. Chaging it to this:\r\n{code}\r\nvar changed = false;\r\n\r\nfunction tbrSortTLbyClicked() {\r\n\tif (!changed) {\r\n\t\t$.tbrSortTLby.removeEventListener(\"click\", tbrSortTLbyClicked);\r\n\t\tconsole.log(new Date() + \" tbrSortTLby Click event triggerred\");\r\n\t\t$.tbrSortTLby.labels = ['Three', 'Four', 'Five'];\r\n\t\t$.tbrSortTLby.addEventListener(\"click\", tbrSortTLbyClicked);\r\n\t\tchanged = true;\r\n\t} else {\r\n\r\n\t}\r\n}\r\n\r\n\r\n$.index.open();\r\n{code}\r\n\r\nwill remove the event listener, change the labels and add it again. No loop. Also added a \"changed\" variable so you will be able to select one of the new values inside the new labels.\r\n\r\nWhen the bar is created it will first set the values and then attach the select-listener:\r\nhttps://github.com/appcelerator/titanium_mobile/blob/0558c28b54dfb195d7a5c22851060e416e9811f8/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUITabbedBar.java#L86-L87\r\nwhen you change the values now the listener is catching the select event and that will trigger the click:\r\nhttps://github.com/appcelerator/titanium_mobile/blob/0558c28b54dfb195d7a5c22851060e416e9811f8/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUITabbedBar.java#L325-L345\r\n\r\nSo you have to remove the click event before changing the value or you could do that inside the SDK when setting new labels.", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-02-23T10:16:48.000+0000", "updated": "2020-02-23T10:16:48.000+0000" }, { "id": "454391", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/11495\r\n\r\nclassic test code:\r\n{code}\r\nvar window = Ti.UI.createWindow();\r\nvar tabbedBar = Ti.UI.createTabbedBar();\r\ntabbedBar.labels = [\"One\", \"Two\", \"Three\"];\r\ntabbedBar.addEventListener(\"click\", function() {\r\n\tconsole.log(new Date() + \" tbrSortTLby Click event triggerred\");\r\n\ttabbedBar.labels = ['Three', 'Four', 'Five'];\r\n})\r\nwindow.add(tabbedBar);\r\nwindow.open();\r\n{code}", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-02-23T10:45:13.000+0000", "updated": "2020-02-23T10:45:13.000+0000" }, { "id": "454890", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR passed, waiting on Jenkins build.", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-03-27T15:56:28.000+0000", "updated": "2020-03-27T15:56:28.000+0000" }, { "id": "456195", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Looks like this will need a back port for 9_1_X now. ", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-07-22T10:52:54.000+0000", "updated": "2020-07-22T10:52:54.000+0000" }, { "id": "456199", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (9.1.x): https://github.com/appcelerator/titanium_mobile/pull/11838", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-07-22T22:03:56.000+0000", "updated": "2020-07-22T22:03:56.000+0000" }, { "id": "456212", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged PRs to master and 9_1_X. Manually cherry-picked to 9_3_X", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2020-07-23T15:08:21.000+0000", "updated": "2020-07-23T15:08:21.000+0000" }, { "id": "456412", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket*. Bug Fixed in SDK version {{9.1.0.v20200810120239}}, {{9.2.0.v20200810085310}} and {{9.3.0.v20200810090511}}.\r\n\r\n*Test and other information can be found at:*\r\nhttps://github.com/appcelerator/titanium_mobile/pull/11495\r\nhttps://github.com/appcelerator/titanium_mobile/pull/11838", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-08-11T15:04:48.000+0000", "updated": "2020-08-11T15:04:48.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }