Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18380] Regression: Programmatically hiding a PopOver showing a ListView with a SearchBar that has focus results in crash

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2015-01-15T17:43:46.000+0000
Affected Version/sRelease 3.5.0
Fix Version/sRelease 3.5.1, Release 4.0.0
ComponentsiOS
Labelslistview, popover, qe-testadded, qe-verified, searchbar
ReporterFokke Zandbergen
AssigneeVishal Duggal
Created2015-01-14T16:12:30.000+0000
Updated2015-03-06T14:58:23.000+0000

Description

This ticket is related to TIMOB-17923 and TIMOB-18260. Though TIMOB-18260 fixes the situation where the popover hides because the user taps outside the popover, this ticket is for the situation where the popover is closed programmatically via hide().

Steps

1. Build the code to iPad Simulator 2. Click the green button 3. Click the searchbar to focus on the field 4. Click the red button to programmatically hide the popover 5. See it crash

Code

var w = Ti.UI.createWindow({
  backgroundColor: 'white'
});

var b = Ti.UI.createButton({
  title: 'Click Me',
  backgroundColor: 'green'
});

b.addEventListener('click', function() {

  var cw = Ti.UI.createWindow({
    width: 300
  });

  var lv = Ti.UI.createListView({
    searchView: Ti.UI.createSearchBar(),
  });

  var bt = Ti.UI.createButton({
    title: 'Focus search then click me',
    backgroundColor: 'red'
  });

  bt.addEventListener('click', function() {
    p.hide();
  });

  cw.add(lv);
  cw.add(bt);

  var p = Ti.UI.iPad.createPopover({
    contentView: cw
  });

  p.show({
    view: b
  });

});

w.add(b);
w.open();

Crash log

[DEBUG] 2015-01-14 14:31:55.492 Timewax[52232:3411517] -[TiUILabelProxy addSubview:]: unrecognized selector sent to instance 0x7bafc200
[ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] Reason:
[ERROR] -[TiUILabelProxy addSubview:]: unrecognized selector sent to instance 0x7bafc200
[ERROR] Stack trace:
[ERROR]
[ERROR] 0   CoreFoundation                      0x05abe92a __exceptionPreprocess + 154
[ERROR] 1   libobjc.A.dylib                     0x05690a97 objc_exception_throw + 44
[ERROR] 2   CoreFoundation                      0x05ac65c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
[ERROR] 3   CoreFoundation                      0x05a0f3e7 ___forwarding___ + 1047
[ERROR] 4   CoreFoundation                      0x05a0efae _CF_forwarding_prep_0 + 14
[ERROR] 5   UIKit                               0x02a49899 -[UISearchDisplayController _hoistSearchBar] + 375
[ERROR] 6   UIKit                               0x02a4a82e -[UISearchDisplayController showHideAnimationDidFinish] + 108
[ERROR] 7   UIKit                               0x02650f72 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 206
[ERROR] 8   UIKit                               0x026512e2 -[UIViewAnimationState animationDidStop:finished:] + 80
[ERROR] 9   UIKit                               0x14ffb50b -[UIViewAnimationStateAccessibility animationDidStop:finished:] + 66
[ERROR] 10  QuartzCore                          0x017eb9d9 _ZN2CA5Layer23run_animation_callbacksEPv + 307
[ERROR] 11  libdispatch.dylib                   0x0639b03f _dispatch_client_callout + 14
[ERROR] 12  libdispatch.dylib                   0x06384764 _dispatch_main_queue_callback_4CF + 470
[ERROR] 13  CoreFoundation                      0x05a1895e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
[ERROR] 14  CoreFoundation                      0x059d7760 __CFRunLoopRun + 2256
[ERROR] 15  CoreFoundation                      0x059d6bcb CFRunLoopRunSpecific + 443
[ERROR] 16  CoreFoundation                      0x059d69fb CFRunLoopRunInMode + 123
[ERROR] 17  GraphicsServices                    0x06b0324f GSEventRunModal + 192
[ERROR] 18  GraphicsServices                    0x06b0308c GSEventRun + 104
[ERROR] 19  UIKit                               0x025e98b6 UIApplicationMain + 1526
[ERROR] 20  Timewax                             0x0006b468 main + 456
[ERROR] 21  libdyld.dylib                       0x063c1ac9 start + 1
[ERROR]
[ERROR] 2015-01-14 14:31:55.505 Timewax[52232:3411517] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TiUILabelProxy addSubview:]: unrecognized selector sent to instance 0x7bafc200'
[ERROR] *** First throw call stack:
[ERROR] (
[ERROR]         0   CoreFoundation                      0x05abe946 __exceptionPreprocess + 182
[ERROR]         1   libobjc.A.dylib                     0x05690a97 objc_exception_throw + 44
[ERROR]         2   CoreFoundation                      0x05ac65c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
[ERROR]         3   CoreFoundation                      0x05a0f3e7 ___forwarding___ + 1047
[ERROR]         4   CoreFoundation                      0x05a0efae _CF_forwarding_prep_0 + 14
[ERROR]         5   UIKit                               0x02a49899 -[UISearchDisplayController _hoistSearchBar] + 375
[ERROR]         6   UIKit                               0x02a4a82e -[UISearchDisplayController showHideAnimationDidFinish] + 108
[ERROR]         7   UIKit                               0x02650f72 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 206
[ERROR]         8   UIKit                               0x026512e2 -[UIViewAnimationState animationDidStop:finished:] + 80
[ERROR]         9   UIKit                               0x14ffb50b -[UIViewAnimationStateAccessibility animationDidStop:finished:] + 66
[ERROR]         10  QuartzCore                          0x017eb9d9 _ZN2CA5Layer23run_animation_callbacksEPv + 307
[ERROR]         11  libdispatch.dylib                   0x0639b03f _dispatch_client_callout + 14
[ERROR]         12  libdispatch.dylib                   0x06384764 _dispatch_main_queue_callback_4CF + 470
[ERROR]         13  CoreFoundation                      0x05a1895e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
[ERROR]         14  CoreFoundation                      0x059d7760 __CFRunLoopRun + 2256
[ERROR]         15  CoreFoundation                      0x059d6bcb CFRunLoopRunSpecific + 443
[ERROR]         16  CoreFoundation                      0x059d69fb CFRunLoopRunInMode + 123
[ERROR]         17  GraphicsServices                    0x06b0324f GSEventRunModal + 192
[ERROR]         18  GraphicsServices                    0x06b0308c GSEventRun + 104
[ERROR]         19  UIKit                               0x025e98b6 UIApplicationMain + 1526
[ERROR]         20  Timewax                             0x0006b468 main + 456
[ERROR]         21  libdyld.dylib                       0x063c1ac9 start + 1
[ERROR] )
[ERROR] libc++abi.dylib: terminating with uncaught exception of type NSException

Comments

  1. Vishal Duggal 2015-01-15

    Pull pending master - https://github.com/appcelerator/titanium_mobile/pull/6575
  2. Vishal Duggal 2015-01-15

    Backport to 3_5_X https://github.com/appcelerator/titanium_mobile/pull/6577
  3. Ewan Harris 2015-01-16

    Verified fix on: Mac OSX 10.10.1 Appcelerator Studio, build: 3.4.1.201410281743 Titanium SDK build: 3.6.0.v20150116070927, 3.5.1.v20150115094121 Titanium CLI, build: 3.4.1 Alloy: 1.5.1 Xcode 6.1.1 iPad Air 2 (8.2b4), iPad Air (7.0.3) Using the attached code built to both devices, the app no longer crashes when the popover is dismissed. Closing ticket.
  4. Eric Wieber 2015-02-19

    Verified working as expected using: Titanium SDK 3.5.1.v20150219110512 Studio 3.4.2.201502181619 CLI 3.4.2-alpha Xcode 6.2b5
  5. Matthew Lanham 2015-03-06

    There is actually still a bug on this, if you highlight the searchBar, and then click outside of the popover to close, it will crash.

JSON Source