diff options
-rw-r--r-- | client/src/com/vaadin/client/ui/VWindow.java | 5 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/table/TableInSubWindowMemoryLeak.java | 68 |
2 files changed, 73 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java index 56dc22908e..bd9493c761 100644 --- a/client/src/com/vaadin/client/ui/VWindow.java +++ b/client/src/com/vaadin/client/ui/VWindow.java @@ -458,6 +458,11 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, private void hideModalityCurtain() { modalityCurtain.removeFromParent(); + if (BrowserInfo.get().isIE()) { + // IE leaks memory in certain cases unless we release the reference + // (#9197) + modalityCurtain = null; + } } /* diff --git a/uitest/src/com/vaadin/tests/components/table/TableInSubWindowMemoryLeak.java b/uitest/src/com/vaadin/tests/components/table/TableInSubWindowMemoryLeak.java new file mode 100644 index 0000000000..dcaabf98d6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableInSubWindowMemoryLeak.java @@ -0,0 +1,68 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; +import com.vaadin.ui.UI; +import com.vaadin.ui.Window; +import com.vaadin.ui.Window.CloseEvent; +import com.vaadin.ui.Window.CloseListener; + +public class TableInSubWindowMemoryLeak extends TestBase { + + @Override + public void setup() { + final Label label = new Label("Hello Vaadin user"); + addComponent(label); + final Button openButton = new Button("open me"); + openButton.addClickListener(new ClickListener() { + + public void buttonClick(final ClickEvent event) { + final Window window = new Window("Simple Window"); + window.setModal(true); + window.setHeight("200px"); + window.setWidth("200px"); + final Table table = new Table(); + window.setContent(table); + UI.getCurrent().addWindow(window); + window.addCloseListener(new CloseListener() { + public void windowClose(final CloseEvent e) { + window.setContent(new Label()); + UI.getCurrent().removeWindow(window); + } + }); + } + }); + addComponent(openButton); + + final Button openButton2 = new Button("open me without Table"); + openButton2.addClickListener(new ClickListener() { + public void buttonClick(final ClickEvent event) { + final Window window = new Window("Simple Window"); + window.setModal(true); + window.setHeight("200px"); + window.setWidth("200px"); + UI.getCurrent().addWindow(window); + window.addCloseListener(new CloseListener() { + public void windowClose(final CloseEvent e) { + UI.getCurrent().removeWindow(window); + } + }); + } + }); + addComponent(openButton2); + } + + @Override + protected String getDescription() { + return "IE 8 leaks memory with a subwindow containing a Table"; + } + + @Override + protected Integer getTicketNumber() { + return 9197; + } +} |