Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Random crash on repeated opening of window with tableview

We have a list of items in a TableView who's rows, when clicked upon open a window with a list of items etc… ( e.row.currentTab.open( Titanium.UI.createWindow( {)

When opening varied levels of windows and closing them again (using the native 'backButton') our App crashes randomly.

The same behavior can be seen in the Kitchensink example 'Base UI' - 'Views' - 'Table Views' - 'Events' and some others, but not all of them.

Does anybody recognize this and more importantly, does anybody has an explanation?

— asked September 26th 2010 by Bas Ovink
  • crash
  • iphone
  • mobile
  • tableview
0 Comments

4 Answers

  • Accepted Answer

    Not that I am expert on this situation, but a few things you might try and see if it helps:

    • classNames on the rows: While it may hurt performance, I have found under some instances Titanium is a little generous in it's re-use of table cells with the same className causing emulators & devices to crash. To see if this is the problem you may try giving all of your cells random classNames. Experiment see if this helps, if it does try to narrow down which rows are causing the problems explicitly.

    • Events: remember that the Titanium.App.addEventListener is actually a global context. At one point (I don't know if it is still true) I found that closing the window and returning to the window again would cause some issues because it would have multiple listeners for the window. I counteracted this by removing the eventlistener on window close.

    • multi-windows: on older hardware, I had an issue where the user would click the row to open a new window, since the device was so slow they would click it twice and we opened two instances of the same window. If this is happening it can cause some unexpected crashes and you should take some steps to prevent the user from clicking twice.

    — answered September 27th 2010 by Mike Robinson
    permalink
    0 Comments
  • I am seeing this same behavior. My app crashes rarely, but when it does it's when I am opening up a new window that contains a table view.

    I'll try some of Mike's suggestions (I do use unique classnames on the rows already, the event listener tip I'll try though).

    Here's hoping we get down to the bottom of this.

    Robby

    — answered October 7th 2010 by Robby Dermody
    permalink
    0 Comments
  • Hey i've been having sort of the same problem.

    I cant seem to open my main window a second time.

    ik basically have a data "array"/"table"
    which has 24 images that function as a background.

    (these are book pages)

    I have a swipe left and righ function that dynamically shows these pages.

    it opens my window1 and shows the first images.
    I swipe right and it closes window1, and opens window2 adds image2…if swiped right again it changes the image to image3.

    if i then swipe left, it closes window2 and should open window1 again but it crashes for this.
    it cannot open this window..

    it could be the eventlistener maybe i need to remove, tried that one time crashes nonetheless but there are more ways..

    I tried checking in instruments..cant find anything.

    kind been searching for a while maybe you guys can guess something.

    its kinda difficult, seeing as the app consists of 1100+ lines at the moment and im not allowed to post the whole code.

    but everything works except for reopening the window1 (it also crashes when I close window2 to go to paintWindow and from paintWindow back to window1 crashes too…

    Long story shot.

    Window1 crashes….

    — answered October 8th 2010 by Patrick van Zadel
    permalink
    0 Comments
  • Had a similar issue with a NavGroup with Table Rows crashing.
    One window on a 2nd opening crashed out. Odd as some other windows were fine.

    Must have been multiple clicks or something as added in a flag and it fixed it.
    Thanks for the pointers chaps!

    Dave

    if (click != 1){
                        click = 1;    
                        nav.open(page);    
                    }
    
    — answered June 17th 2011 by david brewer
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.