{ "id": "65747", "key": "TIMOB-4210", "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": "11330", "description": "Planning Week", "name": "Sprint 2011-21", "archived": true, "released": true, "releaseDate": "2011-05-30" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-05-25T17:44:13.000+0000", "created": "2011-05-24T17:37:20.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "addeventlistener", "orientation" ], "versions": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" } ], "issuelinks": [], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-05-25T17:44:13.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": "Run this code on the device and the app will crash after adding and then removing the event listener on the orientation - after changing the orientation.\n{code}\nvar win1 = Ti.UI.createWindow({\n\torientationModes:[1,2,3,4]\n});\nvar addCount = 0;\nvar btnAdd = Ti.UI.createButton({ \n\ttitle: \"addEvent\",\n\twidth: 200,\n\theight: 50,\n\ttop: 20\n});\nvar btnRemove = Ti.UI.createButton({ \n\ttitle: \"removeEvent\",\n\twidth: 200,\n\theight: 50,\n\ttop: 200\n});\nvar orientationCallback = function(e){\n\tTi.API.info(\"*** orientationCallback called ***\");\n};\n\nbtnAdd.addEventListener('click', function(){\n\tTi.API.info(\"*** ADDING ORIENTATIONCHANGE EVENT\");\n\tTi.Gesture.addEventListener('orientationchange', orientationCallback);\n\tif(addCount > 0){\n\t\tTi.API.info(\"*** ROTATE NOW\");\n\t}\n\taddCount++;\n});\n\nbtnRemove.addEventListener('click', function(){\n\tTi.API.info(\"*** REMOVING ORIENTATIONCHANGE EVENT\");\n\tTi.Gesture.removeEventListener('orientationchange', orientationCallback);\n});\n\nwin1.add(btnAdd);\nwin1.add(btnRemove);\nwin1.open();\n{code}\n\nAnd this is from Xcode's console:\n{code}\n[INFO] *** ADDING ORIENTATIONCHANGE EVENT\n[INFO] *** orientationCallback called ***\n[INFO] *** orientationCallback called ***\n[INFO] *** REMOVING ORIENTATIONCHANGE EVENT\n[INFO] *** ADDING ORIENTATIONCHANGE EVENT\n[INFO] *** ROTATE NOW\n[Switching to process 13315 thread 0x0]\n[Switching to process 13315 thread 0x0]\nCurrent language: auto; currently c++\nwarning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).\n(gdb) bt\n#0 TiObjectCallAsFunction (ctx=0x4b4cee4, object=0xa, thisObject=0x1, argumentCount=1, arguments=0x4ab6b70, exception=0x4ab6b6c) at /Users/stiv/src/appcelerator/tijscore/TiCore/API/TiObjectRef.cpp:413\n#1 0x00036de2 in -[KrollObject triggerEvent:withObject:thisObject:] (self=0x4cefc0, _cmd=0x186560, eventName=0x1bd6dc, eventData=0x4cf5f0, thisObject=0x4cefc0) at /Users/Pedro/Desktop/test/build/iphone/Classes/KrollObject.m:1513\n#2 0x0002b29e in -[KrollEvent invoke:] (self=0x4cf650, _cmd=0x185a22, context=0x4abfc0) at /Users/Pedro/Desktop/test/build/iphone/Classes/KrollContext.mm:597\n#3 0x0002a9cc in -[KrollContext invoke:] (self=0x4abfc0, _cmd=0x185a22, object=0x4cf650) at /Users/Pedro/Desktop/test/build/iphone/Classes/KrollContext.mm:828\n#4 0x0002ccb4 in -[KrollContext main] (self=0x4abfc0, _cmd=0x317445d5) at /Users/Pedro/Desktop/test/build/iphone/Classes/KrollContext.mm:1138\n#5 0x34bc9388 in -[NSThread main] ()\n#6 0x34c3b5cc in __NSThread__main__ ()\n#7 0x3605f310 in _pthread_start ()\n#8 0x36060bbc in thread_start ()\n{code}\nh3. To reproduce:\n- Click on \"addEvent\"\n- Rotate and rotate back\n- Click on \"removeEvent\"\n- Rotate and rotate back\n- Click on \"addEvent\" again.\n- Rotate and CRASH", "attachment": [], "flagged": false, "summary": "iOS - removeEventListener crashes app only on device.", "creator": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "iPhone 4 running 4.3", "comment": { "comments": [ { "id": "134223", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tweaked how we deleted things and learned the importance of TiValueToObject.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-05-24T19:16:42.000+0000", "updated": "2011-05-24T19:16:42.000+0000" }, { "id": "134302", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 1.7.0.364c307... on ipod 3g 4.0.2", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-05-25T17:44:13.000+0000", "updated": "2011-05-25T17:44:13.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }