summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-08-13 16:33:16 +0300
committerLeif Åstrand <leif@vaadin.com>2012-08-13 16:33:16 +0300
commit4a1d729534e1232088529afcd48360d868093a67 (patch)
tree6b2b0425deb4764905ab3260450657bb5deafd3c
parentb998fd14b6453bf0a0da9a870d36ab2f0a7f9726 (diff)
downloadvaadin-framework-4a1d729534e1232088529afcd48360d868093a67.tar.gz
vaadin-framework-4a1d729534e1232088529afcd48360d868093a67.zip
Send destroy event to the same listeners that got the init (#9273)
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java4
-rw-r--r--src/com/vaadin/terminal/gwt/server/AddonContext.java8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java b/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java
index f731cbbdd0..7b51712904 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java
@@ -124,8 +124,8 @@ public abstract class AbstractDeploymentConfiguration implements
@Override
public Iterator<AddonContextListener> getAddonContextListeners() {
- // Called once for init and once for destroy, so it's probably not worth
- // the effort caching the ServiceLoader instance
+ // Called once for init and then no more, so there's no point in caching
+ // the instance
ServiceLoader<AddonContextListener> contextListenerLoader = ServiceLoader
.load(AddonContextListener.class, getClassLoader());
return contextListenerLoader.iterator();
diff --git a/src/com/vaadin/terminal/gwt/server/AddonContext.java b/src/com/vaadin/terminal/gwt/server/AddonContext.java
index 0f887b0fbd..41e9046e22 100644
--- a/src/com/vaadin/terminal/gwt/server/AddonContext.java
+++ b/src/com/vaadin/terminal/gwt/server/AddonContext.java
@@ -25,6 +25,8 @@ public class AddonContext {
private List<BootstrapListener> bootstrapListeners = new ArrayList<BootstrapListener>();
+ private List<AddonContextListener> initedListeners = new ArrayList<AddonContextListener>();
+
public AddonContext(DeploymentConfiguration deploymentConfiguration) {
this.deploymentConfiguration = deploymentConfiguration;
deploymentConfiguration.setAddonContext(this);
@@ -41,15 +43,13 @@ public class AddonContext {
while (listeners.hasNext()) {
AddonContextListener listener = listeners.next();
listener.contextCreated(event);
+ initedListeners.add(listener);
}
}
public void destroy() {
AddonContextEvent event = new AddonContextEvent(this);
- Iterator<AddonContextListener> listeners = deploymentConfiguration
- .getAddonContextListeners();
- while (listeners.hasNext()) {
- AddonContextListener listener = listeners.next();
+ for (AddonContextListener listener : initedListeners) {
listener.contextDestoryed(event);
}
}