From: Henri Sara Date: Thu, 17 Dec 2009 13:26:42 +0000 (+0000) Subject: #3879 removing portlet leaked memory due to ConcurrentModificationException X-Git-Tag: 6.7.0.beta1~2115 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2c53520153e16be01f678c466e268e50acd102ce;p=vaadin-framework.git #3879 removing portlet leaked memory due to ConcurrentModificationException svn changeset:10390/svn branch:6.2 --- diff --git a/src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java b/src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java index 65fe91a267..b8d058d88a 100644 --- a/src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java +++ b/src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java @@ -5,6 +5,7 @@ package com.vaadin.terminal.gwt.server; import java.io.Serializable; import java.util.HashMap; +import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; @@ -83,9 +84,12 @@ public class PortletApplicationContext extends WebApplicationContext implements @Override protected void removeApplication(Application application) { portletListeners.remove(application); - for (Portlet key : portletToApplication.keySet()) { - if (portletToApplication.get(key) == application) { - portletToApplication.remove(key); + for (Iterator it = portletToApplication.values() + .iterator(); it.hasNext();) { + Application value = it.next(); + if (value == application) { + // values().iterator() is backed by the map + it.remove(); } } super.removeApplication(application);