diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-06-01 16:18:02 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-06-01 16:18:02 +0000 |
commit | f768fe1c8fd7314d5dc66a84fbb16b5e9fad0244 (patch) | |
tree | f15760381ef913bc172ddb8039d907c31782a045 /src/com/vaadin/terminal | |
parent | a6c6297858f9b4a19f897c61f9563893a57276d6 (diff) | |
download | vaadin-framework-f768fe1c8fd7314d5dc66a84fbb16b5e9fad0244.tar.gz vaadin-framework-f768fe1c8fd7314d5dc66a84fbb16b5e9fad0244.zip |
Fix for #4315 - Window name generation should be deterministic
svn changeset:13481/svn branch:6.4
Diffstat (limited to 'src/com/vaadin/terminal')
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index 98b95b2a7c..55f9d13fea 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -319,6 +319,8 @@ public abstract class AbstractCommunicationManager implements private DragAndDropService dragAndDropService; + private static int nextUnusedWindowSuffix = 1; + /** * TODO New constructor - document me! * @@ -1543,9 +1545,12 @@ public abstract class AbstractCommunicationManager implements // If the requested window is already open, resolve conflict if (currentlyOpenWindowsInClient.containsKey(window.getName())) { String newWindowName = window.getName(); - while (currentlyOpenWindowsInClient.containsKey(newWindowName)) { - newWindowName = window.getName() + "_" - + ((int) (Math.random() * 100000000)); + + synchronized (AbstractCommunicationManager.class) { + while (currentlyOpenWindowsInClient.containsKey(newWindowName)) { + newWindowName = window.getName() + "_" + + nextUnusedWindowSuffix++; + } } window = application.getWindow(newWindowName); |