Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1744] Window Close Event Happens Too Early

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionNeeds more info
Resolution Date2012-07-26T11:44:06.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelscrash, ios, memory, modal, window
ReporterClifton Labrum
AssigneeNeeraj Gupta
Created2011-04-15T03:01:09.000+0000
Updated2012-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!

Comments

  1. Stephen Tramer 2011-04-15

    Ticket title is misleading. Probably another proxy thing.

  2. Stephen Tramer 2011-04-15

    Also maybe not invalid.

  3. Stephen Tramer 2012-07-25

    Does not include complete, valid test case.

    This ticket may be reopened when a complete test case is added.

JSON Source