{ "id": "62376", "key": "TIMOB-1744", "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": "8", "description": "", "name": "Needs more info" }, "resolutiondate": "2012-07-26T11:44:06.000+0000", "created": "2011-04-15T03:01:09.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "crash", "ios", "memory", "modal", "window" ], "versions": [], "issuelinks": [ { "id": "19376", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "94532", "key": "TIMOB-9901", "fields": { "summary": "TiAPI: Review and clean up platform bugs and reduce bug count by 20%.", "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": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-07-26T22:19:22.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}

I have reason to believe that the close event on a window\nhappens before all its assets are released from memory. I'm doing\nthis in the iPhone only. I'll explain below.

\n

I create a modal window, and use the url property:

\n
\nvar searchModal = Ti.UI.createWindow({ \n     navBarHidden:true, \n     url:'includes/search.js' \n});\n
\n

search.js has about 400k in image assets and\nabout 50k in JS includes (about a thousand lines of code total)\ninside it.

\n

When opening and closing the modal, I do the following:

\n
\nopenButton.addEventListener('click',function(){  \n    searchModal.open(); \n});\n
\n

Then inside search.js:

\n
\ncloseButton.addEventListener('click',function(){ \n   searchModal.close();\n});\n
\n

If I open the modal, close it, then immediately click the open\nbutton again, the app crashes. I can make it crash over and over\nagain. I put an event listener on the window close and notice that\nI'm clicking on the openButton after the 'close' event\nfires, and it still crashes.

\n

If I disable openButton once\nsearchModal opens, then re-enable it on the window\n'close' event, I can still get it to crash. However, if I\nre-enable openButton after about a 1000ms delay, I\ncan't ever get it to crash:

\n
\nsearchModal.addEventListener('close',function(){\n   setTimeout(function(){\n      openButton.enabled = true;        \n   },1000);\n});\n
\n

Please advise. Thank you!

{html}", "attachment": [], "flagged": false, "summary": "Window Close Event Happens Too Early", "creator": { "name": "cliftonlabrum", "key": "cliftonlabrum", "displayName": "Clifton Labrum", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "cliftonlabrum", "key": "cliftonlabrum", "displayName": "Clifton Labrum", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "126533", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Ticket title is misleading. Probably another proxy thing.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:01:10.000+0000", "updated": "2011-04-15T03:01:10.000+0000" }, { "id": "126534", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Also maybe not invalid.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:01:11.000+0000", "updated": "2011-04-15T03:01:11.000+0000" }, { "id": "209492", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "# Does not include complete, valid test case.\r\n\r\nThis ticket may be reopened when a complete test case is added.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-25T17:44:21.000+0000", "updated": "2012-07-25T17:44:21.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }