If you filter BaseAdapter with its own filter function, the following error will occur and crash.
The specific crash point is not specified, but as far as the log goes, is WebView suspicious?It makes me wonder, but there is no place to use WebView in the app.
The following logs are in my application.
06-07 22:28:33.778:W/art(9064):static void art::Dbg::DdmSendHeapSegments(bool) unimplemented Not counting objects in spaceTypeImageSpace begin=0x6f4da000, end=0x6fe4ea88, size=9MB, name="/dachalik]
06-07 22:28:33.961:W/google-breakpad (9064):############################################################
06-07 22:28:33.961:W/Google-breakpad (9064): Chrome build fingerprint:
06-07 22:28:33.961:W/google-breakpad (9064): 1.0
06-07 22:28:33.961:W/google-breakpad (9064):1
06-07 22:28:33.961:W/google-breakpad (9064):92675e2e-3e24-4fdd-9bc9-d979deace950
06-07 22:28:33.961:W/google-breakpad (9064):############################################################
06-07 22:28:33.961:E/chromium (9064):###WebView Version 43.0.2357.121 (code2357121)
06-07 22:28:33.962:A/libc(9064):Fatal signal11(SIGSEGV), code1, fault addr0x0 intid9064(****.******)
The filter function is as follows:
Class Inherited from BaseAdapter
private ArrayList<BoardItem>mOriginalList;//Original Data
private ArrayList <BoardItem>mFilterdlList;// filtered data
private ArrayList <BoardItem>mPublishList;// Display data
private ArrayList<FilterItem>mFilterList;//filter data
public void setData(Collection<?extends BoardItem>data){
synchronized(mLock) {
mOriginalList.clear();
mOriginalList.addAll(data);
filter();
}
notifyDataSetChanged();
}
public void clear() {
synchronized(mLock) {
mOriginalList.clear();
filter();
}
notifyDataSetChanged();
}
public void addAll (Collection <?extends BoardItem>items) {
synchronized(mLock) {
mOriginalList.addAll(items);
filter();
}
notifyDataSetChanged();
}
/**
* Set FilterItem to the adapter to reflect the filter.
*
* @param filterItems
*/
public void setFilterItems(ArrayList<FilterItem>filterItems){
Log.d(TAG, "setFilterItems";
synchronized(mLock) {
mFilterList.clear();
mFilterList.addAll(filterItems);
filter();
}
notifyDataSetChanged();
}
/**
* Set FilterItem to the adapter to reflect the filter.
*
* @param filterItems
*/
public void addFilterItem(FilterItemfilter){
Log.d(TAG, "addFilterItem";
synchronized(mLock) {
mFilterList.clear();
mFilterList.add(filter);
filter();
}
notifyDataSetChanged();
}
/**
* Filter by time constraint (one second before release)
*/
private void filterByTime() {
// time-limited filter
ArrayList<BoardItem>filteredList=newArrayList<>();
ArrayList<BoardItem>copyList=null;
copyList = new ArrayList <(mFilterdlList);
for (Iterator<BoardItem>ite=copyList.iterator();ite.hasNext();){
BoardItem boardItem=(BoardItem)ite.next();
// Current date and time
Calendar nowcal=Calendar.getInstance();
// comparison target date and time
Calendar dateCal=Calendar.getInstance();
try{
dateCal.setTime(mSimpleDateFormat.parse(boardItem.getPublicDate()));
} catch(ParseExceptione){
e.printStackTrace();
}
// Long type difference in milliseconds
long diffTime = nowcal.getTimeInMillis() - dateCal.getTimeInMillis();
if(diffTime>-1000){
filterdList.add(boardItem);
}
}
mPublishList=filterdList;
}
/**
* Perform filter operations
*/
private void filter() {
ArrayList<FilterItem>filterList=null;
filterList = new ArrayList <>(mFilterList);
if(filterList.size()==0){
mFilterdlList = new ArrayList <> (mOriginalList);
filterByTime();
return;
}
ArrayList<BoardItem>filteredList=newArrayList<>();
ArrayList<BoardItem>copyList=null;
copyList = new ArrayList <>(mOriginalList);
BoardItem: for (Iterator<BoardItem>ite=copyList.iterator();ite.hasNext();){
BoardItem item=(BoardItem)ite.next();
for (Iterator<FilterItem>iteFilter=filterList.iterator();iteFilter.hasNext();){
FilterItem filterItem=(FilterItem)iteFilter.next();
if(filterItem.isSelected()){
if(filterItem.match(item.get(filterItem.getGroupName())))){
filterdList.add(item);
breakBoardItem;
}
}
}
}
mFilterdlList = filterdList;
filterByTime();
return;
}
Self-resolved.
filterItem.match(item.get(filterItem.getGroupName()))
Internally, Mattcher was generated from the Pattern class and placed on the member variable, which seems to be the cause.I tried to generate Mattcher each time, but the Fatal Signal Error disappeared.
© 2024 OneMinuteCode. All rights reserved.