Skip to content

Commit 2427192

Browse files
author
Gilles Debunne
committed
Fix for IOOB in SearchView
Bug 6476578 The latest bug report show a query.length() of 33 while mQueryTextView.length() is 0 on line 514. I can see 2 reasons which can explain this discrepancy: - the mQueryTextView has a filter, which alters the text. - some asynchronous event (IME?) changes the text in the mean time. I would favor the second one, which seems to break a lot of single thread assumptions in the code and generates other IOOB exceptions. Note that depending on what they are used for, it may be more consistent to use mQueryTextView.getText() instead of query in the following assignment. Change-Id: Ie8a5486b11a80543f8f90980454933c5a74c073e
1 parent f927e17 commit 2427192

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/java/android/widget/SearchView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ public CharSequence getQuery() {
511511
public void setQuery(CharSequence query, boolean submit) {
512512
mQueryTextView.setText(query);
513513
if (query != null) {
514-
mQueryTextView.setSelection(query.length());
514+
mQueryTextView.setSelection(mQueryTextView.length());
515515
mUserQuery = query;
516516
}
517517

0 commit comments

Comments
 (0)