Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19038] Windows: Crashes when opening windows from a tableview with the QE testing app

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2015-06-25T23:11:47.000+0000
Affected Version/sRelease 4.1.0
Fix Version/sRelease 4.1.0
ComponentsWindows
Labelsqe-4.1.0
ReporterEwan Harris
AssigneeGary Mathews
Created2015-06-17T22:01:13.000+0000
Updated2015-06-30T18:47:52.000+0000

Description

Description

When using the QE testing apps, if I open one test case then the next test case I open will crash the application. I have attached an example app as APIModule.zip

Steps To Reproduce

1. Download the attached project and build it for device or emulator 2. Open test case TIMOB7187 3. Close the window 4. Open test case TIMOB9214 5. Reverse steps 2-4

Actual Result

When attempting open the second test case window the app will crash

Expected Result

The app should not crash

Attachments

FileDateSize
APIModule.zip2015-06-17T21:54:10.000+00003125699

Comments

  1. Ewan Harris 2015-06-21

    Bit more information due to TIMOB-19034 when this happens the following is printed in the console [ERROR] Application Error: "Runtime Error during click event: unknown exception"
  2. Gary Mathews 2015-06-24

    Here's code to reproduce the problem. It seem's we cant add a single UI element to +multiple+ windows.
       var main = Ti.UI.createWindow({ backgroundColor: 'black' }),
           desc = Ti.UI.createLabel({text: '\'OPEN\' and \'CLOSE\' more than once.', top: '25%'}),
       	btn = Ti.UI.createButton({ title: 'OPEN' }),
       
       	btn_close = Ti.UI.createButton({ title: 'CLOSE' }); // Create this once
       
       btn.addEventListener('click', function () {
           var win = Ti.UI.createWindow({ backgroundColor: 'blue' });
       
           // Add 'btn_close' to potentially multiple windows
           win.add(btn_close); // This causes the exception
       
           btn_close.addEventListener('click', function () {
               win.close();
           });
       
           win.open();
       });
       
       main.add(desc);
       main.add(btn);
       main.open();
       
  3. Gary Mathews 2015-06-25

    [~eharris] To fix the problem replace createTableView in _ui.js_ with :
       function createTableView(_level) {
           var tableView = Ti.UI.createTableView();
           
           // populate the rows with test cases
           if (_level == 'Acceptance') {
               var testCases = at.createData();
               tableView.setData(testCases);
           }
           
           // launch each test case when selected
           tableView.addEventListener('click', function(_e) {
               var win = createTestCase(_e.rowData),
                   done = Titanium.UI.createButton({
                       title: "Done",
                       height: 50,
                       width: 50,
                       bottom: 0,
                       right: 0
                   });
       
               win.add(done);
               done.addEventListener('click', function() {
                   win.close();
               });
       
               win.open();
           });
       
           return tableView;
       }
       
    This creates a new instance of done for every window.
  4. Kota Iguchi 2015-06-25

    ??Here's code to reproduce the problem. It seem's we cant add a single UI element to multiple windows.?? Confirmed that it doesn't work because Windows Xaml components doesn't accept this. I can say it is a limitation of Xaml.UI.Controls, not because of Titanium LayoutEngine.
  5. Gary Mathews 2015-06-25

    We should add a more descriptive error message.
  6. Gary Mathews 2015-06-25

    PR: https://github.com/appcelerator/titanium_mobile_windows/pull/325
  7. Lokesh Choudhary 2015-06-30

    Verified the fix. We now get error with a more descriptive message :
    [ERROR] :  Application Error: "Runtime Error during click event: No installed components were detected.\r\n\r\nElement is already the child of another element."
    Closing. Environment: Appc Studio: 4.1.0.201506261427 Ti SDK: 4.1.0.v20150630092706 Ti CLI: 4.0.1 Alloy: 1.6.2 Windows: 8.1 Enterprise 64-bit APPC NPM: 4.1.0-1 APPC CLI: 4.1.0-4 Device: Nokia Lumia 928 - Windows Phone 8.1 Windows emulator : 8.1

JSON Source