{ "id": "63792", "key": "TIMOB-3160", "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": "11333", "description": "Mobile 1.8.0 M01", "name": "Sprint 2011-22", "archived": true, "released": true, "releaseDate": "2011-06-06" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-11-05T15:46:33.000+0000", "created": "2011-04-15T03:38:21.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [ { "id": "11231", "name": "Release 1.5.1", "archived": true, "released": true, "releaseDate": "2011-01-24" } ], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-11-05T15:46:33.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}

Application crashes when you try to use 'this' in\r\nremoveEventListener to remove an addEventListener who's function\r\nyou are in.

\r\n

This code sample if from the code example at \r\nhttp://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI....

\r\n
\r\n\r\nvar view = Titanium.UI.createView({\r\n   backgroundColor:'red'\r\n});\r\nvar animation = Titanium.UI.createAnimation();\r\nanimation.backgroundColor = 'black';\r\nanimation.duration = 1000;\r\nanimation.addEventListener('complete',function()\r\n{\r\n   animation.removeEventListener('complete',this);\r\n   animation.backgroundColor = 'orange';\r\n   view.animate(animation);\r\n});\r\nview.animate(animation);\r\n
\r\n

tested with 1.5.1, 1.6.0RC1, iOS SDK 4.2

\r\n

Associated Helpdesk Ticket

\r\n

http://developer.appcelerator.com/helpdesk/view/73881

{html}", "attachment": [], "flagged": false, "summary": "iOS: removeEventListener crashes when passed 'this'", "creator": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "130185", "author": { "name": "marky", "key": "marky", "displayName": "marky", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

You might use 'arguments.callee' instead of 'this' to solve this\nissue.

\n

'arguments.callee' is itself that no name inner function.

\n

animation.addEventListener('complete',function()
\n{ animation.backgroundColor = 'orange'; view.animate(animation);\nanimation.removeEventListener('complete', arguments.callee);\n});

\n

sorry, poor my english.

{html}", "updateAuthor": { "name": "marky", "key": "marky", "displayName": "marky", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:38:22.000+0000", "updated": "2011-04-15T03:38:22.000+0000" }, { "id": "134824", "author": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This is actually failing properly. The sample code in the API doc has been updated to show the proper way to do this.", "updateAuthor": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-03T12:44:38.000+0000", "updated": "2011-06-03T12:44:38.000+0000" }, { "id": "134832", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "body": "this is pointing to the animation not the function. ", "updateAuthor": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-03T13:04:23.000+0000", "updated": "2011-06-03T13:04:23.000+0000" }, { "id": "140660", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Waiting for 1.7.0 to push which should update API docs.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-06T15:31:36.000+0000", "updated": "2011-06-06T15:31:36.000+0000" }, { "id": "166690", "author": { "name": "avaghti", "key": "avaghti", "displayName": "Alan Vaghti", "active": true, "timeZone": "America/Los_Angeles" }, "body": "While testing fix, corresponding Android bug was opened: TIMOB-5340", "updateAuthor": { "name": "avaghti", "key": "avaghti", "displayName": "Alan Vaghti", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-22T15:47:14.000+0000", "updated": "2011-09-22T15:47:14.000+0000" }, { "id": "168145", "author": { "name": "avaghti", "key": "avaghti", "displayName": "Alan Vaghti", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Fix verified in 1.8.0.v20111006001414. The application no longer crashes, but it also never transitions to orange. A new bug was filed for that issue: TIMOB-5459", "updateAuthor": { "name": "avaghti", "key": "avaghti", "displayName": "Alan Vaghti", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-10-06T11:50:13.000+0000", "updated": "2011-10-06T11:50:13.000+0000" }, { "id": "171669", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Standardizing summary and labels.", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-05T15:46:20.000+0000", "updated": "2011-11-05T15:46:20.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }