summaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorPekka Hyvönen <pekka@vaadin.com>2014-03-14 16:17:27 +0200
committerHenri Sara <hesara@vaadin.com>2014-03-14 16:17:27 +0200
commit0c7cbc73dba97ad0b95cb11f4b4eabb37046fe61 (patch)
tree40fe7b9f17b8b343ab3cc224a47711e3c8b8911d /client/src
parent2f9318610ca83902060173bf0caae1a2fe385f21 (diff)
downloadvaadin-framework-0c7cbc73dba97ad0b95cb11f4b4eabb37046fe61.tar.gz
vaadin-framework-0c7cbc73dba97ad0b95cb11f4b4eabb37046fe61.zip
Fixes a memory leak on IE8 in LayoutManagerIE8 (#12688)
Change-Id: Ieae3b1d82e92fadf5ab517c1c878fc82bcc0ecbd
Diffstat (limited to 'client/src')
-rw-r--r--client/src/com/vaadin/client/LayoutManager.java9
-rw-r--r--client/src/com/vaadin/client/LayoutManagerIE8.java15
2 files changed, 22 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java
index 1ced003146..5b27031a29 100644
--- a/client/src/com/vaadin/client/LayoutManager.java
+++ b/client/src/com/vaadin/client/LayoutManager.java
@@ -75,6 +75,15 @@ public class LayoutManager {
}
/**
+ * Returns the application connection for this layout manager.
+ *
+ * @return connection
+ */
+ protected ApplicationConnection getConnection() {
+ return connection;
+ }
+
+ /**
* Gets the layout manager associated with the given
* {@link ApplicationConnection}.
*
diff --git a/client/src/com/vaadin/client/LayoutManagerIE8.java b/client/src/com/vaadin/client/LayoutManagerIE8.java
index a692f126a2..97e3059a22 100644
--- a/client/src/com/vaadin/client/LayoutManagerIE8.java
+++ b/client/src/com/vaadin/client/LayoutManagerIE8.java
@@ -21,6 +21,7 @@ import java.util.Map;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Node;
import com.google.gwt.user.client.ui.RootPanel;
/**
@@ -39,6 +40,12 @@ public class LayoutManagerIE8 extends LayoutManager {
private Map<Element, MeasuredSize> measuredSizes = new HashMap<Element, MeasuredSize>();
+ // this method is needed to test for memory leaks (see
+ // LayoutMemoryUsageIE8ExtensionConnector) but can be private
+ private int getMeasuredSizesMapSize() {
+ return measuredSizes.size();
+ }
+
@Override
protected void setMeasuredSize(Element element, MeasuredSize measuredSize) {
if (measuredSize != null) {
@@ -62,12 +69,16 @@ public class LayoutManagerIE8 extends LayoutManager {
@Override
protected void cleanMeasuredSizes() {
Profiler.enter("LayoutManager.cleanMeasuredSizes");
- Document document = RootPanel.get().getElement().getOwnerDocument();
+
+ // #12688: IE8 was leaking memory when adding&removing components.
+ // Uses IE specific logic to figure if an element has been removed from
+ // DOM or not. For removed elements the measured size is discarded.
+ Node rootNode = Document.get().getBody();
Iterator<Element> i = measuredSizes.keySet().iterator();
while (i.hasNext()) {
Element e = i.next();
- if (e.getOwnerDocument() != document) {
+ if (!rootNode.isOrHasChild(e)) {
i.remove();
}
}