Ticket #1392 (closed defect: fixed)
Review Window.open code, it may leak memory (how to release these resources?)
| Reported by: | Jani Laakso | Owned by: | Jani Laakso |
|---|---|---|---|
| Priority: | undefined | Milestone: | User Interface Library 5.2.0 RC |
| Component: | undefined | Version: | |
| Keywords: | Cc: | ||
| Known Issue description: | |||
| Hours estimate: | Deadline (dd.mm.yyyy): | ||
| Known Issue version (since): | Known Issue title: | ||
| Hours done: | Depends to: | ||
| Affects documentation: | no | ||
| Known Issue workaround: | |||
| Affects release notes: | yes | Contract: | |
Description
Window class contains code that should be refactored.
If I call Window.open, it's resources cannot be released (unless releasing main window).
E.g. these reserve memory but there is no way to release these resources:
main.addComponent(new Button(
"Open a application-level window, with shared state",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
if (windowUrl == null) {
final Window w = new Window("Subwindow");
final Label l = new Label(txt);
l.setContentMode(Label.CONTENT_XHTML);
w.addComponent(l);
getApplication().addWindow(w);
windowUrl = w.getURL();
}
getApplication().getMainWindow().open(
new ExternalResource(windowUrl), "_new");
}
}));
main.addComponent(new Button(
"Create a new application-level window, with it's own state",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
final Window w = new Window("Subwindow");
getApplication().addWindow(w);
final Label l = new Label(
"Each opened window has its own"
+ " name, and is accessed trough its own uri.");
l.setCaption("Window " + w.getName());
w.addComponent(l);
getApplication().getMainWindow().open(
new ExternalResource(w.getURL()), "_new");
}
}));
Change History
Note: See
TracTickets for help on using
tickets.
