Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23711] iOS: Incrementing instances of "Window is not open Ignoring this close call" on win.close()

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2016-08-02T15:44:10.000+0000
Affected Version/sRelease 5.4.0
Fix Version/sn/a
Componentsn/a
Labelsqe-5.4.0
ReporterHarry Bryant
AssigneeHans Knöchel
Created2016-08-01T17:43:35.000+0000
Updated2016-08-02T16:38:32.000+0000

Description

*This does not occur with 5.3.1.GA* when opening and closing the window a couple of times, I receive the following DEBUG log:
[DEBUG] :  Window is not open. Ignoring this close call
The log count is incremented every time I cycle through Open / Close. For example after 5 cycles I receive the following:
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
[DEBUG] :  Window is not open. Ignoring this close call
( 1 + 2 + 3 + 4 + 5 )

TEST CODE

Ti.UI.backgroundColor = "Black";
 
var win = Ti.UI.createWindow({backgroundColor:'blue'});
 
var open = Ti.UI.createButton({
	title: 'Open Window'	
});
 
var close = Ti.UI.createButton({
	title: 'Close Window'
});
 
open.addEventListener('click', function(){
	var win2 = Ti.UI.createWindow({backgroundColor:'green'});
	win2.add(close);
	close.addEventListener('click', function(){
		win2.close();
	});
	win2.open();
});
 
win.add(open);
win.open();

Steps to Reproduce

1. Create a new Classic Mobile Project. 2. Copy above test code into app.js file. 4. Run App to device / sim. 5. Click on "Open Window" button. 6. Click on "Close Window" button. 7. Repeat Steps 5-6 to receive the log message

Actual Result

Incrementing count of [DEBUG] : Window is not open. Ignoring this close call

Expected Result

[DEBUG] : Window is not open. Ignoring this close call only when relevant, and should not increment every cycle.

Comments

  1. Hans Knöchel 2016-08-01

    I'm wondering if that could be related to the event-listeners inside the event-listener causing. But as you're saying it didn't happen in 5.3.1.GA, it's making me unsure. *EDIT*: The close button is defined outside the scope, I'm 80 % sure that's the problem here. That would also explain, why the sum of logs (1+2+3+4+5) is as it is, because the existing event-listeners are still being triggered because they are scoped to the close button outside the click-event. *EDIT2*: And the reason why it isn't logged in 5.3.1.GA may be, because the log is only thrown when using main-thread. *EDIT3*: Not reproducible anymore using the correct demo-code following here:
       var win = Ti.UI.createWindow({backgroundColor:'blue'});
        
       var open = Ti.UI.createButton({
       	title: 'Open Window'	
       });
        
       open.addEventListener('click', function(){
       	var win2 = Ti.UI.createWindow({backgroundColor:'green'});
       	
       	var close = Ti.UI.createButton({
       		title: 'Close Window'
       	});
       	
       	win2.add(close);
       	close.addEventListener('click', function(){
       		win2.close();
       	});
       	win2.open();
       });
        
       win.add(open);
       win.open();
       
    [~htbryant] Please verify and close, thanks!
  2. Hans Knöchel 2016-08-02

    Resolving as invalid for now, [~htbryant] to confirm.
  3. Harry Bryant 2016-08-02

    Can confirm that the issue was the close button being defined outside of the scope. Closing as Invalid.

JSON Source