mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 22:09:30 +00:00
Fix ConcurrentModificationException
This commit is contained in:
parent
dc324359c2
commit
1daffd4af5
@ -99,10 +99,18 @@ public class SafeAsyncTasksManager {
|
|||||||
* @param cls The tasks to disable
|
* @param cls The tasks to disable
|
||||||
*/
|
*/
|
||||||
public void unsetSpecificTasks(Class<?> cls){
|
public void unsetSpecificTasks(Class<?> cls){
|
||||||
for (SafeAsyncTask task : mTasks){
|
ArrayList<SafeAsyncTask> toRemove = new ArrayList<>();
|
||||||
if(task.getClass().equals(cls))
|
|
||||||
unsetTask(task);
|
|
||||||
|
|
||||||
|
for(int i = 0; i < mTasks.size(); i++){
|
||||||
|
if(mTasks.get(i).getClass().equals(cls))
|
||||||
|
toRemove.add(mTasks.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (toRemove.size() > 0){
|
||||||
|
SafeAsyncTask task = toRemove.get(toRemove.size() - 1);
|
||||||
|
unsetTask(task);
|
||||||
|
toRemove.remove(task);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user