[TIMOB-18260] iOS: Removing a ListView while SearchBar has focus results in crash
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-12-19T07:56:21.000+0000 |
Affected Version/s | Release 3.4.1, Release 3.5.0 |
Fix Version/s | Release 3.5.0, Release 4.0.0 |
Components | iOS |
Labels | listview, popover, qe-3.5.0, searchbar |
Reporter | Fokke Zandbergen |
Assignee | Vishal Duggal |
Created | 2014-12-18T10:41:30.000+0000 |
Updated | 2015-08-10T21:55:04.000+0000 |
Description
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.
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
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();
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
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();
Attachments
File | Date | Size |
---|---|---|
popsearch.crash | 2014-12-18T10:41:30.000+0000 | 40547 |
Combined test case
Pulls pending master - https://github.com/appcelerator/titanium_mobile/pull/6513 3_5_X - https://github.com/appcelerator/titanium_mobile/pull/6514
Please review this one.
CR and FT passed. Merged PRs.
Thanks for the super quick fix guys. Just patched my 3.5.0.Beta and it works indeed.
Verified fixed using: Titanium SDK 3.5.0.v20141222103320 Studio 3.4.1.201410281743 Xcode 6.1.1 On: iPad mini, iOS 8.1 iPhone 6, iOS 8.2b3 iPhone 4S Sim, iOS 8.1
[~ingo] [~ewieber] I can still reproduce it with the code following and the next steps/environment 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 Titanium SDK 3.5.0.v20141222103320 CLI 3.4.1 Xcode 6.1.1 iPad MD788NF/A (Air), iOS 8.1.2 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.
Don't know what happend to the code above. Here it is:
Ah... shows OK after refresh.