Project: titanium
Issue TIMOB-18260: iOS: Removing a ListView while SearchBar has focus results in crash
A popover that has a SearchBar attached to a ListView will crash if it hides will the SearchBar still has focus. Same goes for when the ListView is removed from its parent view while the SearchBar has focus, so that seems to be the actual problem. The crashlog is attached. h1. Test case #1 1. Install an app with the following code on an iPad (crashes on iOS Simulator as well, but doesn't show crashlog) 2. Tap the button 3. Tap the searchbar to focus 4. Tap outside the popover to hide it 5. App crashes after a second or so {code:javascript} var w = Ti.UI.createWindow({ backgroundColor: 'white' }); var b = Ti.UI.createButton({ title: 'Click' }); b.addEventListener('click', function() { var cw = Ti.UI.createWindow({ width: 300, height: 300 }); var lv = Ti.UI.createListView({ searchView: Ti.UI.createSearchBar() }); cw.add(lv); var p = Ti.UI.iPad.createPopover({ width: 300, height: 300, contentView: cw }); p.show({ view: b }); }); w.add(b); w.open(); {code} h1. Test case #2 1. Install an app with the following code on an iOS device (crashes on iOS Simulator as well, but doesn't show crashlog) 2. Tap the searchbar to focus 3. Tap the button to remove the ListView 4. App crashes after a second or so {code:javascript} var w = Ti.UI.createWindow({ backgroundColor: 'white' }); var lv = Ti.UI.createListView({ top: 100, searchView: Ti.UI.createSearchBar() }); var b = Ti.UI.createButton({ top: 30, title: 'Click me after focussing on search field' }); b.addEventListener('click', function() { w.remove(lv); }); w.add(b); w.add(lv); w.open(); {code}
Story points: 8