X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPaintRefresher.java;h=ced554482e83da5104a0f2fea34c10e12c5cd176;hb=86b84a537a05d03a21ba115bffe3575cedf98be0;hp=1b90d827d3e90b7e08120c109844446a7702ec56;hpb=17e77c3f2949a0729322b4a8d907f3f34b6a9914;p=jalview.git diff --git a/src/jalview/gui/PaintRefresher.java b/src/jalview/gui/PaintRefresher.java index 1b90d82..ced5544 100755 --- a/src/jalview/gui/PaintRefresher.java +++ b/src/jalview/gui/PaintRefresher.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9) - * Copyright (C) 2015 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -26,9 +26,9 @@ import jalview.datamodel.SequenceI; import java.awt.Component; import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Map.Entry; /** * Route datamodel/view update events for a sequence set to any display @@ -74,26 +74,21 @@ public class PaintRefresher */ public static void RemoveComponent(Component comp) { - List emptied = new ArrayList(); - for (Entry> registered : components.entrySet()) + if (components == null) { - String id = registered.getKey(); - List comps = components.get(id); + return; + } + + Iterator it = components.keySet().iterator(); + while (it.hasNext()) + { + List comps = components.get(it.next()); comps.remove(comp); if (comps.isEmpty()) { - emptied.add(id); + it.remove(); } } - - /* - * Remove now empty ids after the above (to avoid - * ConcurrentModificationException). - */ - for (String id : emptied) - { - components.remove(id); - } } public static void Refresh(Component source, String id) @@ -188,8 +183,8 @@ public class PaintRefresher { // raise an implementation warning here - not sure if this situation // will ever occur - System.err - .println("IMPLEMENTATION PROBLEM: DATASET out of sync due to an insert whilst calling PaintRefresher.validateSequences(AlignmentI, ALignmentI)"); + System.err.println( + "IMPLEMENTATION PROBLEM: DATASET out of sync due to an insert whilst calling PaintRefresher.validateSequences(AlignmentI, ALignmentI)"); } List alsq; synchronized (alsq = comp.getSequences())