[TIMOB-1744] Window Close Event Happens Too Early
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2012-07-26T11:44:06.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | crash, ios, memory, modal, window |
Reporter | Clifton Labrum |
Assignee | Neeraj Gupta |
Created | 2011-04-15T03:01:09.000+0000 |
Updated | 2012-07-26T22:19:22.000+0000 |
Description
I have reason to believe that the close event on a window happens before all its assets are released from memory. I'm doing this in the iPhone only. I'll explain below.
I create a modal window, and use the url property:
var searchModal = Ti.UI.createWindow({
navBarHidden:true,
url:'includes/search.js'
});
search.js has about 400k in image assets and about 50k in JS includes (about a thousand lines of code total) inside it.
When opening and closing the modal, I do the following:
openButton.addEventListener('click',function(){
searchModal.open();
});
Then inside search.js:
closeButton.addEventListener('click',function(){
searchModal.close();
});
If I open the modal, close it, then immediately click the open button again, the app crashes. I can make it crash over and over again. I put an event listener on the window close and notice that I'm clicking on the openButton after the 'close' event fires, and it still crashes.
If I disable openButton once searchModal opens, then re-enable it on the window 'close' event, I can still get it to crash. However, if I re-enable openButton after about a 1000ms delay, I can't ever get it to crash:
searchModal.addEventListener('close',function(){
setTimeout(function(){
openButton.enabled = true;
},1000);
});
Please advise. Thank you!
Ticket title is misleading. Probably another proxy thing.
Also maybe not invalid.
Does not include complete, valid test case.
This ticket may be reopened when a complete test case is added.