Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-15188

iOS7: Tapping Tab Orphans Windows on Tab's Stack

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Component/s: iOS
    • Environment:

      Description

      Problem

      In version 3.1.3 and above tapping the tab's button to return to the root window of the tab orphans any windows between the current window and the root window. This works as expected in 3.1.2 GA but 3.1.3 has serious regression bug

      Why This Is A Problem

      Orphaned windows equate to leaked memory. Windows in the middle of the root and last window are orphaned and all resources are trapped. Causes crash on device after lots of use.

      Expected Behavior

      Tapping the tab's button should close every window that is open on that tab's stack, not just the current window. On version 3.1.2 it does the following which is correct:

      3.1.2 Console Log

      [ERROR] :  Opened: A
      [ERROR] :  Opened: B
      [ERROR] :  Opened: C
      [ERROR] :  Closed: C
      [ERROR] :  Closed: B
      [ERROR] :  Closed: A
      

      Reproduction

      Drop the following in an app.js. Use the Open Window A, B & C buttons to drill through the widows. Notice in the log which windows were opened, and which were closed. Tap the tab to return to root and only the last window (window c) is closed.

      Test Case

      app.js

      // Create Tab Group
      var tabGrp = Ti.UI.createTabGroup({
      	backgroundColor:'white',
      });
       
      // Tab Window 1
      var win1 = Ti.UI.createWindow({
      	backgroundColor:'red',
      	title:'Tab 1'
      });
      var button1 = Ti.UI.createButton({ title: 'Open Window A' });
      button1.addEventListener('click', function(event) {
      	tab1.open(winA);
      });
      win1.add(button1);
       
      // Tab Window 2
      var win2 = Ti.UI.createWindow({
      	backgroundColor:'green',
      	title:'Tab 2'
      });
       
      // Tab Window 3
      var win3 = Ti.UI.createWindow({
      	backgroundColor:'blue',
      	title:'Tab 3'
      });
       
      // Child Window A
      var winA = Ti.UI.createWindow({
      	backgroundColor:'yellow',
      	title:'Window A'
      });
      var buttonA = Ti.UI.createButton({ title: 'Open Window B' });
      buttonA.addEventListener('click', function(event) {
      	tab1.open(winB);
      });
      winA.add(buttonA);
      winA.addEventListener('open', function(event) {
      	Ti.API.error('Opened: A');
      });
      winA.addEventListener('close', function(event) {
      	Ti.API.error('Closed: A');
      });
       
      // Child Window B
      var winB = Ti.UI.createWindow({
      	backgroundColor:'yellow',
      	title:'Window B'
      });
      var buttonB = Ti.UI.createButton({ title: 'Open Window C' });
      buttonB.addEventListener('click', function(event) {
      	tab1.open(winC);
      });
      winB.add(buttonB);
      winB.addEventListener('open', function(event) {
      	Ti.API.error('Opened: B');
      });
      winB.addEventListener('close', function(event) {
      	Ti.API.error('Closed: B');
      });
       
      // Child Window C
      var winC = Ti.UI.createWindow({
      	backgroundColor:'yellow',
      	title:'Window C'
      });
      winC.addEventListener('open', function(event) {
      	Ti.API.error('Opened: C');
      });
      winC.addEventListener('close', function(event) {
      	Ti.API.error('Closed: C');
      });
       
      // Add Tabs
      var tab1 = Ti.UI.createTab({window:win1,title:'TAB1'});
      var tab2 = Ti.UI.createTab({window:win2,title:'TAB2'});
      var tab3 = Ti.UI.createTab({window:win3,title:'TAB3'});
      tabGrp.addTab(tab1);
      tabGrp.addTab(tab2);
      tabGrp.addTab(tab3);
       
      // Open Tab Group
      tabGrp.open();
      

      Logs

      3.1.3 Console Log

      [ERROR] :  Opened: A
      [ERROR] :  Opened: B
      [ERROR] :  Opened: C
      [ERROR] :  Closed: C
      

        Attachments

          Activity

            People

            • Assignee:
              vduggal Vishal Duggal (Inactive)
              Reporter:
              isams Alastair Price
              Reviewer:
              Sabil Rahim
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-17461
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration