Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18345] iOS: Crash if all results from search in ListView fit on view

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-01-08T22:29:27.000+0000
Affected Version/sRelease 3.4.1, Release 3.5.0
Fix Version/sRelease 3.5.0, Release 4.0.0
ComponentsiOS
LabelsListView, ios, popover, qe-3.5.0, searchBar
ReporterEric Wieber
AssigneePedro Enrique
Created2015-01-08T18:28:32.000+0000
Updated2015-01-08T23:24:10.000+0000

Description

App crashes when filtering results in a ListView, that is in a popover, if the number of items filtered is less then needed to fill the few height of the listview. This is not a regression as it also occurs with 3.4.1.GA. *Steps to reproduce issue*: 1. Tap the button to open the popover 2. Tap the searchbar and enter "odd" 3. Hide the soft keyboard using the dedicated button on the soft keyboard 4. App crashes *Expected Results*: able to search or dismiss keyboard without crash *Actual Results*: App crashes with below error *Notes*: I've found that it only happens if the number of items filtered is less then needed to fill the few height of the listview. If you increase the number of items to 50 you won't be able to replicate.
var w = Ti.UI.createWindow({
  backgroundColor: 'white'
});
 
var b = Ti.UI.createButton({
  title: 'Click Me'
});
 
b.addEventListener('click', function() {
 
  var cw = Ti.UI.createWindow({
    width: 300
  });
 
  var items = [];
 
  for (var i = 1, oe; i <= 20; i++) {
    oe = (i % 2 === 0) ? 'even' : 'odd';
    items.push({
      properties: {
        title: 'Row #' + i + ' (' + oe + ')',
        searchableText: oe
      }
    });
  }
 
  var lv = Ti.UI.createListView({
    searchView: Ti.UI.createSearchBar(),
    sections: [Ti.UI.createListSection({
      items: items
    })]
  });
 
  cw.add(lv);
 
  var p = Ti.UI.iPad.createPopover({
    contentView: cw
  });
 
  p.show({
    view: b
  });
});
 
w.add(b);
w.open();
Error thrown is a Range Exception; beyond bounds:
[ERROR] :  The application has crashed with an uncaught exception 'NSRangeException'.
[ERROR] :  Reason:
[ERROR] :  *** -[__NSArrayM objectAtIndex:]: index 16 beyond bounds [0 .. 9]
[ERROR] :  Stack trace:
[ERROR] :  
[ERROR] :  0   CoreFoundation                      0x0000000183225e48 <redacted> + 132
[ERROR] :  1   libobjc.A.dylib                     0x0000000193ce40e4 objc_exception_throw + 60
[ERROR] :  2   CoreFoundation                      0x000000018310b77c <redacted> + 0
[ERROR] :  3   00 Classic Test                     0x0000000100160fa4 00 Classic Test + 1347492
[ERROR] :  4   00 Classic Test                     0x00000001001675d4 00 Classic Test + 1373652
[ERROR] :  5   UIKit                               0x0000000187ccb14c <redacted> + 544
[ERROR] :  6   UIKit                               0x0000000187cbfd00 <redacted> + 2360
[ERROR] :  7   UIKit                               0x0000000187aa7888 <redacted> + 224
[ERROR] :  8   UIKit                               0x0000000187aa7758 <redacted> + 1020
[ERROR] :  9   UIKit                               0x0000000187aa696c <redacted> + 276
[ERROR] :  10  UIKit                               0x00000001879eacd4 <redacted> + 600
[ERROR] :  11  UIKit                               0x00000001880c88e8 <redacted> + 56
[ERROR] :  12  CoreFoundation                      0x000000018311cff0 <redacted> + 132
[ERROR] :  13  CoreFoundation                      0x000000018311ce94 <redacted> + 248
[ERROR] :  14  UIKit                               0x00000001879da478 <redacted> + 132
[ERROR] :  15  UIKit                               0x00000001879ce07c <redacted> + 476
[ERROR] :  16  00 Classic Test                     0x0000000100075504 00 Classic Test + 382212
[ERROR] :  17  UIKit                               0x00000001879eacd4 <redacted> + 600
[ERROR] :  18  CoreFoundation                      0x000000018311cff0 <redacted> + 132
[ERROR] :  19  CoreFoundation                      0x000000018311ce94 <redacted> + 248
[ERROR] :  20  UIKit                               0x00000001879da478 <redacted> + 132
[ERROR] :  21  UIKit                               0x00000001879ce07c <redacted> + 476
[ERROR] :  22  00 Classic Test                     0x0000000100075504 00 Classic Test + 382212
[ERROR] :  23  UIKit                               0x00000001879eacd4 <redacted> + 600
[ERROR] :  24  CoreFoundation                      0x000000018311cff0 <redacted> + 132
[ERROR] :  25  CoreFoundation                      0x000000018311ce94 <redacted> + 248
[ERROR] :  26  UIKit                               0x00000001879da478 <redacted> + 132
[ERROR] :  27  UIKit                               0x00000001879ce07c <redacted> + 476
[ERROR] :  28  UIKit                               0x00000001879eacd4 <redacted> + 600
[ERROR] :  29  CoreFoundation                      0x000000018311cff0 <redacted> + 132
[ERROR] :  30  CoreFoundation                      0x000000018311ce94 <redacted> + 248
[ERROR] :  31  UIKit                               0x00000001879da478 <redacted> + 132
[ERROR] :  32  UIKit                               0x00000001879ce07c <redacted> + 476
[ERROR] :  33  UIKit                               0x0000000187c2a880 <redacted> + 152
[ERROR] :  34  UIKit                               0x00000001879d1a2c <redacted> + 572
[ERROR] :  35  QuartzCore                          0x0000000187329994 <redacted> + 168
[ERROR] :  36  QuartzCore                          0x0000000187324564 <redacted> + 320
[ERROR] :  37  UIKit                               0x00000001879e5e10 <redacted> + 160
[ERROR] :  38  UIKit                               0x00000001879ce118 <redacted> + 632
[ERROR] :  39  UIKit                               0x0000000187c2ba20 <redacted> + 684
[ERROR] :  40  UIKit                               0x0000000187a09464 <redacted> + 508
[ERROR] :  41  UIKit                               0x0000000187a210b4 <redacted> + 68
[ERROR] :  42  UIKit                               0x000000018810ede8 <redacted> + 376
[ERROR] :  43  Foundation                          0x00000001840e84a8 __NSFireDelayedPerform + 424
[ERROR] :  44  CoreFoundation                      0x00000001831ddfd4 <redacted> + 28
[ERROR] :  45  CoreFoundation                      0x00000001831ddc84 <redacted> + 888
[ERROR] :  46  CoreFoundation                      0x00000001831db6d0 <redacted> + 1372
[ERROR] :  47  CoreFoundation                      0x00000001831091f4 CFRunLoopRunSpecific + 396
[ERROR] :  48  GraphicsServices                    0x000000018c2735a4 GSEventRunModal + 168
[ERROR] :  49  UIKit                               0x0000000187a3a784 UIApplicationMain + 1488
[ERROR] :  50  00 Classic Test                     0x000000010001d48c 00 Classic Test + 21644
[ERROR] :  51  libdyld.dylib                       0x0000000194352a08 <redacted> + 4
[ERROR] :  *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 16 beyond bounds [0 .. 9]'
[ERROR] :  *** First throw call stack:
[ERROR] :  (0x183225e48 0x193ce40e4 0x18310b77c 0x100160fa4 0x1001675d4 0x187ccb14c 0x187cbfd00 0x187aa7888 0x187aa7758 0x187aa696c 0x1879eacd4 0x1880c88e8 0x18311cff0 0x18311ce94 0x1879da478 0x1879ce07c 0x100075504 0x1879eacd4 0x18311cff0 0x18311ce94 0x1879da478 0x1879ce07c 0x100075504 0x1879eacd4 0x18311cff0 0x18311ce94 0x1879da478 0x1879ce07c 0x1879eacd4 0x18311cff0 0x18311ce94 0x1879da478 0x1879ce07c 0x187c2a880 0x1879d1a2c 0x187329994 0x187324564 0x1879e5e10 0x1879ce118 0x187c2ba20 0x187a09464 0x187a210b4 0x18810ede8 0x1840e84a8 0x1831ddfd4 0x1831ddc84 0x1831db6d0 0x1831091f4 0x18c2735a4 0x187a3a784 0x10001d48c 0x194352a08)

Comments

  1. Fokke Zandbergen 2015-01-08

    Also reproduces with 3.4.1.GA SDK so it's not a regression in 3.5.0
  2. Pedro Enrique 2015-01-08

    PR: https://github.com/appcelerator/titanium_mobile/pull/6551
  3. Pedro Enrique 2015-01-08

    3.5.x https://github.com/appcelerator/titanium_mobile/pull/6555
  4. Eric Wieber 2015-01-08

    Verified fixed, using: Titanium SDK 3.5.0.v20150108143317 Studio 3.4.1.201410281743 Xcode 6.1.1 On: iPad mini, iOS 8.1 iPad Air 2, iOS 8.1 The crash is no longer encountered with the sample code, when dismissing the keyboard or searching.

JSON Source