]> source.dussan.org Git - vaadin-framework.git/commitdiff
Revert "Call UI.detach in UI cleanup (#9755)" because it breaks logout functionality... 77/177/1
authorArtur Signell <artur@vaadin.com>
Fri, 26 Oct 2012 13:24:54 +0000 (13:24 +0000)
committerVaadin Code Review <review@vaadin.com>
Fri, 26 Oct 2012 13:24:54 +0000 (13:24 +0000)
This reverts commit 41fb6006d916c8cb512c9aa6fbf8e5d1f4e377db

server/src/com/vaadin/server/VaadinServiceSession.java
server/src/com/vaadin/ui/UI.java
server/tests/src/com/vaadin/tests/server/TestUICleanup.java [deleted file]

index 92c06cdf468d7621b53834b7645f2887787538f8..de5accbfd08ef268ee58d8152c0658299db592ca 100644 (file)
@@ -742,12 +742,7 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
         Integer id = Integer.valueOf(ui.getUIId());
         uIs.remove(id);
         retainOnRefreshUIs.values().remove(id);
-
-        UI current = UI.getCurrent();
-        UI.setCurrent(ui);
         ui.fireCleanupEvent();
-        ui.setSession(null);
-        UI.setCurrent(current);
     }
 
     /**
index c7627f71dbaf64173d71393f82c1bc178a61c780..d57d38b371ef0a0b7631effb0d406c354b8d8be0 100644 (file)
@@ -634,7 +634,10 @@ public abstract class UI extends AbstractComponentContainer implements
      * For internal use only.
      */
     public void fireCleanupEvent() {
+        UI current = UI.getCurrent();
+        UI.setCurrent(this);
         fireEvent(new CleanupEvent(this));
+        UI.setCurrent(current);
     }
 
     @Override
diff --git a/server/tests/src/com/vaadin/tests/server/TestUICleanup.java b/server/tests/src/com/vaadin/tests/server/TestUICleanup.java
deleted file mode 100644 (file)
index 83d6838..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.vaadin.tests.server;
-
-import org.easymock.EasyMock;
-import org.junit.Test;
-
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinService;
-import com.vaadin.server.VaadinServiceSession;
-import com.vaadin.ui.UI;
-import com.vaadin.ui.UI.CleanupEvent;
-import com.vaadin.ui.UI.CleanupListener;
-
-public class TestUICleanup {
-
-    @Test
-    public void uiDetach() {
-        VaadinService service = EasyMock.createMock(VaadinService.class);
-
-        UI ui = EasyMock.createMock(UI.class);
-        ui.setSession(null);
-        ui.detach();
-        ui.fireCleanupEvent();
-        EasyMock.expect(ui.getUIId()).andReturn(1);
-
-        EasyMock.replay(service, ui);
-
-        VaadinServiceSession session = new VaadinServiceSession(service);
-
-        session.cleanupUI(ui);
-    }
-
-    @Test
-    public void uiCleanupListeners() {
-        CleanupListener listener = EasyMock.createMock(CleanupListener.class);
-        listener.cleanup(EasyMock.anyObject(CleanupEvent.class));
-
-        EasyMock.replay(listener);
-
-        UI ui = new UI() {
-            @Override
-            protected void init(VaadinRequest request) {
-            }
-        };
-
-        ui.addCleanupListener(listener);
-        ui.fireCleanupEvent();
-    }
-}