{ "id": "124184", "key": "TIMOB-16116", "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": "10100", "description": "This issue won't be actioned.", "name": "Won't Do" }, "resolutiondate": "2020-01-09T22:15:33.000+0000", "created": "2013-12-25T18:55:32.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "alloy", "android" ], "versions": [ { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "issuelinks": [], "assignee": null, "updated": "2020-01-09T22:15: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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "In a controller ( that is opened by another controller ), the local variables are garbage collected. When events are called trying to access those local variables, they are garbage collect and as result error out and the app crashes. \r\n\r\nFor example, this code errors out:\r\n\r\n{code}\r\nvar options = ['a','b','c','d','e'];\r\n\r\nvar optionsDialogOpts = {\r\n options:options,\r\n cancel:options.length-1,\r\n selectedIndex: 0\r\n};\r\nvar dialog1 = Titanium.UI.createOptionDialog(optionsDialogOpts);\r\nvar dialog2 = Titanium.UI.createOptionDialog(optionsDialogOpts);\r\nvar dialog3 = Titanium.UI.createOptionDialog(optionsDialogOpts);\r\nvar dialog4 = Titanium.UI.createOptionDialog(optionsDialogOpts);\r\nvar dialog5 = Titanium.UI.createOptionDialog(optionsDialogOpts);\r\n\r\nfunction showDialog1() { dialog1.show(); }\r\nfunction showDialog2() { dialog2.show(); }\r\nfunction showDialog3() { dialog3.show(); }\r\nfunction showDialog4() { dialog4.show(); }\r\nfunction showDialog5() { dialog5.show(); }\r\n{code}\r\n\r\n\r\nTo fix this I've had to globalize the variables\r\n\r\n{code}\r\nvar options = ['a','b','c','d','e'];\r\n\r\nvar optionsDialogOpts = {\r\n options:options,\r\n cancel:options.length-1,\r\n selectedIndex: 0\r\n};\r\ndialog1 = Titanium.UI.createOptionDialog(optionsDialogOpts);\r\ndialog2 = Titanium.UI.createOptionDialog(optionsDialogOpts);\r\ndialog3 = Titanium.UI.createOptionDialog(optionsDialogOpts);\r\ndialog4 = Titanium.UI.createOptionDialog(optionsDialogOpts);\r\ndialog5 = Titanium.UI.createOptionDialog(optionsDialogOpts);\r\n\r\nfunction showDialog1() { dialog1.show(); }\r\nfunction showDialog2() { dialog2.show(); }\r\nfunction showDialog3() { dialog3.show(); }\r\nfunction showDialog4() { dialog4.show(); }\r\nfunction showDialog5() { dialog5.show(); }\r\n{code}\r\n\r\nAnd that works. \r\n\r\nJust to be clear, this error exists specifically when the above controller is opened from another controller:\r\n\r\n{code}\r\nfunction clickLogin() {\r\n var b = Alloy.createController('main');\r\n b.getView().open();\r\n}\r\n{code}\r\n\r\nThe error in the logs when this error happens is the following:\r\n\r\n{code}\r\nF/libc ( 4384): Fatal signal 11 (SIGSEGV) at 0x00000014 (code=1), thread 4398 (KrollRuntimeThr)\r\nI/DEBUG ( 113): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\r\nI/DEBUG ( 113): Build fingerprint: 'generic/vbox86p/vbox86p:4.1.1/JRO03S/eng.buildbot.20131216.105737:userdebug/test-keys'\r\nI/DEBUG ( 113): pid: 4384, tid: 4398, name: KrollRuntimeThr >>> com.testapp.test <<<\r\nI/DEBUG ( 113): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000014\r\nI/DEBUG ( 113): eax 99757f24 ebx 99757cec ecx 999c7750 edx 00000000\r\nI/DEBUG ( 113): esi 00000000 edi 999c768c\r\nI/DEBUG ( 113): xcs 00000073 xds 0000007b xes 0000007b xfs 00000000 xss 0000007b\r\nI/DEBUG ( 113): eip 9910ee29 ebp 999c7694 esp 999c7650 flags 00010246\r\nI/DEBUG ( 113): \r\nI/DEBUG ( 113): backtrace:\r\nI/DEBUG ( 113): #00 pc 00076e29 /data/data/com.testapp.test/lib/libkroll-v8.so (titanium::JavaObject::getJavaObject()+41)\r\nI/DEBUG ( 113): #01 pc 00013034 [heap]\r\nI/DEBUG ( 113): #02 pc 000bd308 [heap]\r\nI/DEBUG ( 113): \r\n{code}\r\n\r\nI have put this sample app here: https://bitbucket.org/mcpuddin/alloy-error-crash-for-android", "attachment": [ { "id": "44811", "filename": "app.zip", "author": { "name": "mcpuddin", "key": "mcpuddin", "displayName": "James McBryan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-26T05:13:58.000+0000", "size": 3820637, "mimeType": "application/zip" } ], "flagged": false, "summary": "Android: Controller Scoped Variables collected during Android Garbage Collection", "creator": { "name": "mcpuddin", "key": "mcpuddin", "displayName": "James McBryan", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mcpuddin", "key": "mcpuddin", "displayName": "James McBryan", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "TI SDK 3.2.0\r\nAlloy 1.2.2", "comment": { "comments": [ { "id": "285800", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I am sorry but I cannot spot the difference between the code that works and code that does not. I am having trouble getting the sample example app from the above link so I would appreciate if you can attach a simple test with this ticket itself.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-26T04:46:49.000+0000", "updated": "2013-12-26T04:46:49.000+0000" }, { "id": "285805", "author": { "name": "mcpuddin", "key": "mcpuddin", "displayName": "James McBryan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Code that does not work with Android Garbage Collection.", "updateAuthor": { "name": "mcpuddin", "key": "mcpuddin", "displayName": "James McBryan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-26T05:13:58.000+0000", "updated": "2013-12-26T05:13:58.000+0000" }, { "id": "285807", "author": { "name": "mcpuddin", "key": "mcpuddin", "displayName": "James McBryan", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "mcpuddin", "key": "mcpuddin", "displayName": "James McBryan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-26T05:16:00.000+0000", "updated": "2013-12-26T05:16:00.000+0000" }, { "id": "285810", "author": { "name": "mcpuddin", "key": "mcpuddin", "displayName": "James McBryan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Here is a youtube video of the error that is happening running my attached code. I didn't have audio at the time and not sure if I got good resolution, but I am basically doing the following\n\n- Showing the error\n- Adjusting the code and showing no error\n- Showing the error again, but it doesn't work initially, so I close the app out and re-run it and then it happens\n\nhttp://www.youtube.com/watch?v=xOjDgmmUAu0", "updateAuthor": { "name": "mcpuddin", "key": "mcpuddin", "displayName": "James McBryan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-26T05:40:10.000+0000", "updated": "2013-12-26T05:40:10.000+0000" }, { "id": "453611", "author": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. \r\n\r\nIf community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.", "updateAuthor": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-01-09T22:15:33.000+0000", "updated": "2020-01-09T22:15:33.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }