Bug 971735 - Remove element using iterator while looping in ArrayList. r=wesj, a=sledru
authorLucas Rocha <lucasr@mozilla.com>
Mon, 17 Feb 2014 11:07:53 +0000
changeset 182924 8035d6585f66588f616013f42f3b5a90fcecfb19
parent 182923 d92b94557663258e7d06c73c388cff3bee601a85
child 182925 05c3913ec2d07879158f4dd2206115bbace0862b
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj, sledru
bugs971735
milestone29.0a2
Bug 971735 - Remove element using iterator while looping in ArrayList. r=wesj, a=sledru
mobile/android/base/widget/ActivityChooserModel.java
--- a/mobile/android/base/widget/ActivityChooserModel.java
+++ b/mobile/android/base/widget/ActivityChooserModel.java
@@ -793,17 +793,18 @@ public class ActivityChooserModel extend
      * @return True if the record was added.
      */
     private boolean removeHistoricalRecordsForPackage(final String pkg) {
         boolean removed = false;
 
         for (Iterator<HistoricalRecord> i = mHistoricalRecords.iterator(); i.hasNext();) {
             final HistoricalRecord record = i.next();
             if (record.activity.getPackageName().equals(pkg)) {
-                removed = mHistoricalRecords.remove(record);
+                i.remove();
+                removed = true;
             }
         }
 
         if (removed) {
             mHistoricalRecordsChanged = true;
             pruneExcessiveHistoricalRecordsIfNeeded();
             persistHistoricalDataIfNeeded();
             sortActivitiesIfNeeded();