{ "id": "88045", "key": "TIMOB-8048", "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": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13277", "name": "Sprint 2012-08", "archived": true, "released": true, "releaseDate": "2012-04-22" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-07-13T01:24:15.000+0000", "created": "2012-03-15T19:40:44.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "SupportTeam", "core", "module_tabgroup", "qe-testadded" ], "versions": [ { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" }, { "id": "13070", "description": "Release 1.8 Service Pack 2", "name": "Release 1.8.2", "archived": true, "released": true, "releaseDate": "2012-02-29" } ], "issuelinks": [ { "id": "16685", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "83337", "key": "TIMOB-6436", "fields": { "summary": "Android: change window.js addEventListener and addWrappedListener to use this.view rather than window", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "updated": "2014-01-23T18:07: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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "removeEventListener does not work on android, when used to remove and eventlistener on 'focus' event.\r\n\r\n\r\nRun the code below. Do the following:\r\n\r\nopen app\r\nalert comes up - clear it\r\nclick on Win 2's tab\r\nclick on Win 1's tab\r\nObserved behavior: alert comes up again (the event listener wasn't removed during the call to onFocus ()).\r\n\r\nExpected behavior: the second alert should not come up (the event listener should have been removed during the call to onFocus())\r\n\r\nThinking that maybe it was because I was calling removeEventListener() from within the event listener function, I also added a button that should remove the event listener from the window. It doesn't work either.\r\n\r\n{code}\r\nvar tabGroup = Ti.UI.createTabGroup();\r\n\r\nvar win1 = Ti.UI.createWindow({ backgroundColor: '#fff', title: 'Win 1' });\r\ntabGroup.addTab(Ti.UI.createTab({\r\n window: win1,\r\n title: win1.title\r\n}));\r\n\r\nvar win2 = Ti.UI.createWindow({ backgroundColor: '#666', title: 'Win 2' });\r\ntabGroup.addTab(Ti.UI.createTab({\r\n window: win2,\r\n title: win2.title\r\n}));\r\n\r\nvar onFocus = function ()\r\n{\r\n alert('[focus] size: ' + win1.size.width + ', ' + win1.size.height); \r\n win1.removeEventListener ('focus', onFocus);\r\n}\r\n\r\nwin1.addEventListener('focus', onFocus);\r\n\r\nvar btn1 = Titanium.UI.createButton({\r\n width: 200,\r\n height: 50,\r\n title: 'Click me',\r\n});\r\n\r\nbtn1.addEventListener('click', function(e) {\r\n win1.removeEventListener ('focus', onFocus);\r\n});\r\nwin1.add(btn1);\r\n\r\n\r\ntabGroup.open();\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: removeEventListener does not work for the CI Builds", "creator": { "name": "dgandhi", "key": "dgandhi", "displayName": "Devang Gandhi", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "dgandhi", "key": "dgandhi", "displayName": "Devang Gandhi", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium SDK: CI Build\r\nAndroid SDK: 2.2", "comment": { "comments": [ { "id": "190517", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Debugged this for a while, it seems that this could be a tab issue, and/or context related. Removing listeners work fine, but it seems we may be storing multiple copies of it via events.js. This bug does NOT affect custom events. For example, if you run this code:\r\n{code}\r\nvar tabGroup = Ti.UI.createTabGroup();\r\n \r\nvar win1 = Ti.UI.createWindow({ backgroundColor: '#fff', title: 'Win 1' });\r\ntabGroup.addTab(Ti.UI.createTab({\r\n window: win1,\r\n title: win1.title\r\n}));\r\n \r\nvar win2 = Ti.UI.createWindow({ backgroundColor: '#666', title: 'Win 2' });\r\ntabGroup.addTab(Ti.UI.createTab({\r\n window: win2,\r\n title: win2.title\r\n}));\r\n \r\nvar onFocus = function ()\r\n{\r\n alert('[focus] size: ' + win1.size.width + ', ' + win1.size.height); \r\n //win1.removeEventListener ('a', function(){});\r\n}\r\n \r\nwin1.addEventListener('a', onFocus);\r\n \r\nvar btn1 = Titanium.UI.createButton({\r\n width: 200,\r\n height: 50,\r\n title: 'Remove listener',\r\n});\r\nvar btn2 = Titanium.UI.createButton({\r\n top: 100,\r\n width: 200,\r\n height: 50,\r\n title: 'Fire event',\r\n});\r\n \r\nbtn1.addEventListener('click', function(e) {\r\n win1.removeEventListener ('a', onFocus);\r\n //win1.addEventListener('focus', function(){});\r\n //win1.fireEvent('focus');\r\n});\r\nbtn2.addEventListener('click', function(e) {\r\n win1.fireEvent('a');\r\n});\r\nwin1.add(btn1);\r\nwin1.add(btn2);\r\n\r\n//win1.open();\r\n \r\ntabGroup.open();\r\n{code}\r\n\r\n1. Click Fire Event, you should see an alert\r\n2. Click Remove Event, then Fire Event, you SHOULD NOT see an alert", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-10T16:57:21.000+0000", "updated": "2012-04-10T16:57:21.000+0000" }, { "id": "191456", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "PR https://github.com/appcelerator/titanium_mobile/pull/2026 opened", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2012-04-17T15:01:21.000+0000", "updated": "2012-04-17T15:01:21.000+0000" }, { "id": "199933", "author": { "name": "sguduru", "key": "sguduru", "displayName": "Smitha Guduru", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The second alert is not coming up even after switching from \"Win 2\" tab to \"Win 1\" tab.\r\n\r\nVerified on\r\nTitanium Studio, build: 2.2.0.201206222035\r\nTitanium SDK: 2.1.0.v20120622174154\r\nDevice:Xoom(4.0.3)", "updateAuthor": { "name": "sguduru", "key": "sguduru", "displayName": "Smitha Guduru", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-23T14:49:38.000+0000", "updated": "2012-06-23T14:49:38.000+0000" }, { "id": "203093", "author": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Re-opening to edit label", "updateAuthor": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-13T01:23:42.000+0000", "updated": "2012-07-13T01:23:42.000+0000" }, { "id": "283457", "author": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/5074\n", "updateAuthor": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-10T05:56:45.000+0000", "updated": "2013-12-10T05:56:45.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }