summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2010-12-14 13:21:17 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2010-12-14 13:21:17 +0000
commitdcc370da016fa8a95ef02b784b9a1439b845ea48 (patch)
tree856a48fcc751a05463738873b1c542c5645dedb1
parent80f356e85409126e8073e3a7e96087791f00a37c (diff)
downloadvaadin-framework-dcc370da016fa8a95ef02b784b9a1439b845ea48.tar.gz
vaadin-framework-dcc370da016fa8a95ef02b784b9a1439b845ea48.zip
fixes #6150, see also #6060, #6061
svn changeset:16501/svn branch:6.5
-rwxr-xr-xsrc/com/vaadin/terminal/gwt/client/ApplicationConnection.java31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
index 7f72e745a9..ef850313e0 100755
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
@@ -138,6 +138,8 @@ public class ApplicationConnection {
private Set<Paintable> zeroHeightComponents = null;
+ private Set<String> unregistryBag = new HashSet<String>();
+
public ApplicationConnection() {
view = GWT.create(VView.class);
}
@@ -973,6 +975,8 @@ public class ApplicationConnection {
}
}
+ purgeUnregistryBag();
+
// TODO build profiling for widget impl loading time
final long prosessingTime = (new Date().getTime())
@@ -1072,23 +1076,46 @@ public class ApplicationConnection {
/**
* Unregisters the given paintable; always use after removing a paintable.
- * Does not actually remove the paintable from the DOM.
+ * This method does not remove the paintable from the DOM, but marks the
+ * paintable so that ApplicationConnection may clean up its references to
+ * it. Removing the widget from DOM is component containers responsibility.
*
* @param p
* the paintable to remove
*/
public void unregisterPaintable(Paintable p) {
+
+ // add to unregistry que
+
if (p == null) {
VConsole.error("WARN: Trying to unregister null paintable");
return;
}
String id = getPid(p);
- idToPaintableDetail.remove(id);
+ unregistryBag.add(id);
if (p instanceof HasWidgets) {
unregisterChildPaintables((HasWidgets) p);
}
}
+ private void purgeUnregistryBag() {
+ for (String id : unregistryBag) {
+ // check if can be cleaned
+ Widget component = (Widget) idToPaintableDetail.get(id)
+ .getComponent();
+ if (!component.isAttached()) {
+ // clean reference from ac to paintable
+ idToPaintableDetail.remove(id);
+ }
+ /*
+ * else NOP : same component has been reattached to another parent
+ * or replaced by another component implementation.
+ */
+ }
+
+ unregistryBag.clear();
+ }
+
/**
* Unregisters a paintable and all it's child paintables recursively. Use
* when after removing a paintable that contains other paintables. Does not