GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-12-16T18:16:13.000+0000 |
Affected Version/s | Release 1.8.0.1, Release 2.0.0, Release 1.8.2 |
Fix Version/s | Release 2.1.0, Sprint 2012-08 |
Components | iOS |
Labels | SupportTeam, core, module_window, qe-testadded, regression |
Reporter | Mauro Parra-Miranda |
Assignee | Vishal Duggal |
Created | 2012-03-26T15:26:27.000+0000 |
Updated | 2017-03-16T21:46:15.000+0000 |
Problem description
I have a NavigationGroup, and two windows. Intermittently, when the second window is closed, the first window goes comatose (won't respond to any clicks).
Actual results
the window is not throwing the close event when closing.
Expected results
the window should throw the close event when closing
Test case
1. Create a mobile project
2. Add this three files
var FirstWindow=Ti.UI.createWindow({
url:'MOMain.js',
layout:'vertical',
navBarHidden:false
});
Ti.App.NavGroup=Ti.UI.iPhone.createNavigationGroup({window:FirstWindow});
var NavBase=Ti.UI.createWindow();
NavBase.add(Ti.App.NavGroup);
NavBase.open(); // this opens the "root" window, which is FirstWindow, automatically
var MainWin=Ti.UI.currentWindow;
function OnFocus(evt)
{
if (evt.source == MainWin)
{
Ti.App.CurrentWindow=MainWin;
}
}
MainWin.title='Here is something';
Ti.App.CurrentWindow=MainWin;
MainWin.addEventListener('focus',OnFocus);
function SetupButtonClick()
{
var SecondWin=Ti.UI.createWindow({
url:'MOSetup.js',
layout:'vertical',
navBarHidden:false
});
Ti.App.NavGroup.open(SecondWin,{animated:true});
}
var SetupButton=Ti.UI.createButton({width:200,
height:100,
title:'Hit Me'});
SetupButton.addEventListener('click',SetupButtonClick);
MainWin.add(SetupButton);
var Win2=Ti.UI.currentWindow;
function HandleiPhoneCloseEvent()
{
if (Ti.App.DevelopmentMode)
Ti.API.info('# Window HandleiPhoneCloseEvent fired');
Win2.removeEventListener('close',HandleiPhoneCloseEvent);
Win2=null; // attempt to release the window's memory
}
Win2.title='Window 2';
Ti.App.CurrentWindow=Win2;
Win2.addEventListener('close',HandleiPhoneCloseEvent); // catches the iPhone NavGroup back button close
3. Run the app
4. Click on the "Hit Me" button
5. Click the navgroup's back button
6. Try to click on the "Hit Me" button again
Extra info
This seems to be timing dependent, so you may have to repeat the 2 clicks several times. I can make it happen in under 30 seconds...usually within 5 seconds. My best reproduction comes by waiting 2.5 seconds before clicking the back button. If you have trouble reproducing this, vary the time between seeing the second window and clicking the back button (faster and then slower).
After some investigation, I can see that the 'close' event of the second window never fires when the problem occurs (neither does the focus event of the first window).
This seems to point to a serious flaw. In a larger app, the failure occurs 80% of the time. Our app is totally dead in the water because of this, and we need to release it soon. Can you please take a look into this?
Please note that I've reduced this down about as far as possible, while still demonstrating the error. Removing any of the references to Ti.App or removing any of the event listeners hides the problem, but all of my apps are dependent on these.
The issue isn't just that the 'close' event doesn't occur...it's that no events occur and the entire UI goes dead. It has something to do with going "back" from a NavigationGroup (either by calling NavGroup.close(TheWindow) or simply clicking the native "back" button). The *previous* window doesn't get a focus event either, although it is shown.
HD ticket: http://support.appcelerator.com/tickets/APP-494437
More info: This is a *regression* that occurred between SDK 1.7.5 and SDK 1.8.0.1. Works fine in 1.7.5 Broken in 1.8.0.1, 1.8.1, 1.8.2, and 2.0.0.v...
More info: I can make this happen in a larger app, even after I removed the NavigationGroup and native Navbar, so the root cause of the problem may not be NavigationGroups at all.
Can't reproduce. Attempted with sample app on iPod 4GT and iPhone Sim 5.1, with specified instructions with 2.1.0.c7fc284 (master @ 4/13/2012). We either require a more specific test which can reliably demonstrate this issue, or a confirmation that the problem has been resolved.
Stephen, please consider reopening this ticket. The highest version of iOS I tested on is iOS *5.0*, as specified in the Environment details. I have never found an exact set of steps that will reproduce this problem consistently, but the testcase I have presented in this ticket will produce the problem within 5 to 30 seconds max if you keep at it. I think your best bet for finding this problem is to use the 2.0.0 (03/25/12 21:33 963fcfe) SDK version with the iOS 5.0 simulator and see it break. Hopefully you can look at some kind of trace/log to find the problem, and then look for that same problem in the latest master SDK. I can provide a full-sized project that reproduces this problem. Federico reproduced it with the testcase (see the HD ticket referenced above).
I just reproduced this with the testcase shown in this ticket with *2 clicks*, using SDK 2.1.0.v20120416160358 and the 5.0 iOS simulator. Like I said in the ticket's text, "My best reproduction comes by waiting 2.5 seconds before clicking the back button." Stephen, please email me directly if you still can't make this happen. Thanks.
Issue reopened because the test case is reproducable
PR merged https://github.com/appcelerator/titanium_mobile/pull/2038
Verified fixed in SDK 2.1.0.v20120608174150.
Closing as Fixed. SDK: 2.1.0.v20120622174154 Studio: 2.1.0.201206221045 OS: Lion 10.7.4 Xcode: 4.3.2 Devices Tested: iPod 4.3.3, iPad3 5.1.1, iPhone Simulator 5.1 Test Steps 1. Run attached project TIMOB-8314.zip 2. Perform the following cycle 30 times: Open and close the window by pressing: 'Hit Me' then 'Here is something' Expected Result: First window should never freeze up.
This issue is seen with SDK : 3.5.0.v20141215113314. The close event does not fire & the first window goes dead(nothing happens on clicking "Hit Me"). I am able to reproduce this issue with in 2 clicks. This is a regression. Issue is not seen with 3.4.1.GA. Reopening. Environment: Appc Studio : 3.4.1.201410281743 Ti SDK : 3.5.0.v20141215113314 CLI : 3.4.1 Alloy : 1.5.1 GA Code Processor : 1.1.1 MAC Yosemite : 10.10 Iphone 5S - 8.0.2 Ipad 3 - 8.1 XCode - Version 6.1.1
Moving into 3.5.0. We can bump it out if necessary. [~jalter] and [~cng], could you take a look?
At a glance, the sample code uses Ti.UI.iPhone.NavigationGroup which has been removed since 3.2.0. It has been replaced with Ti.UI.iOS.NavigationWindow. (since 3.1.3) [~lchoudhary], Is there an updated code sample so that we can reproduce this error?
Here's a simple test case for catching the close event:
Works fine in Environment: Appc Studio : 3.4.1.201410281743 Ti SDK : latest build, 3.5.0.v20141125154115, 3.4.1 GA CLI : 3.4.1 MAC Yosemite : 10.10.1 iOS simulator - 7.1, 8.1 XCode - Version 6.1
[~cng] Verified it & the issue is not reproducible when using Ti.UI.iOS.NavigationWindow. Closing the ticket.
The reopening of the issue was not valid as the test used NavigationGroup which is removed & is not reproducible with Navigationwindow. Reverting back to the original resolution: "Fixed".
Closing ticket as the issue has been fixed.