diff options
author | Jonatan Kronqvist <jonatan@vaadin.com> | 2013-09-09 14:14:49 +0300 |
---|---|---|
committer | Jonatan Kronqvist <jonatan@vaadin.com> | 2013-09-09 14:14:49 +0300 |
commit | 0d79a84494b21a3b553d56245c4a1ee09fb022b4 (patch) | |
tree | cf3b31a8183984007b8f7fd9a6a5d28b4c482311 /server | |
parent | 24ffbc2095e00cbb984c6e8d75f5d16c4670e35a (diff) | |
download | vaadin-framework-0d79a84494b21a3b553d56245c4a1ee09fb022b4.tar.gz vaadin-framework-0d79a84494b21a3b553d56245c4a1ee09fb022b4.zip |
Added a comment that hopefully explains the NULL_OBJECT #12509
Change-Id: I99ea86d8842324884dda3a5c392f37e8d4a7acf6
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/util/CurrentInstance.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/server/src/com/vaadin/util/CurrentInstance.java b/server/src/com/vaadin/util/CurrentInstance.java index 39c2a60a5c..4c62ef49be 100644 --- a/server/src/com/vaadin/util/CurrentInstance.java +++ b/server/src/com/vaadin/util/CurrentInstance.java @@ -237,6 +237,22 @@ public class CurrentInstance implements Serializable { if (v == null) { removeStale = true; } else if (v == NULL_OBJECT) { + /* + * NULL_OBJECT is used to identify objects that are null when + * #setCurrent(UI) or #setCurrent(VaadinSession) are called on a + * CurrentInstance. Without this a reference to an already + * collected instance may be left in the CurrentInstance when it + * really should be restored to null. + * + * One example case that this fixes: + * VaadinService.runPendingAccessTasks() clears all current + * instances and then sets everything but the UI. This makes + * UI.accessSynchronously() save these values before calling + * setCurrent(UI), which stores UI=null in the map it returns. + * This map will be restored after UI.accessSync(), which, + * unless it respects null values, will just leave the wrong UI + * instance registered. + */ set(c, null, ci.inheritable); } else { set(c, v, ci.inheritable); |