PDA

View Full Version : [CLOSED] WindowListener Events.Minimize Stack Overflow Error



Fretze
15 Sep 2010, 1:24 AM
Hi Guys, it looks like a bug. I've implemented a window and added a minimize button and an minimize event. Here a little bit java gxt code:


this.setClosable(true);
this.setMaximizable(true);
this.setMinimizable(true);
this.addListener(Events.Minimize, new WindowListener() {
@Override
public void windowMinimize(WindowEvent we) {
minimize();
}
});
"this" stays for the extended Window Class from GXT 2. I get an error while i press the minimize button:

java.lang.StackOverflowError: null
at java.util.HashMap.get(Unknown Source)
at com.extjs.gxt.ui.client.core.FastMap.get(FastMap.java:223)
at com.extjs.gxt.ui.client.event.BaseObservable.fireEvent(BaseObservable.java:82)
at com.extjs.gxt.ui.client.widget.Component.fireEvent(Component.java:454)
at com.extjs.gxt.ui.client.widget.Window.minimize(Window.java:569)

If i change the minimize(); method into hide(); method in the window event it works fine. Is it a bug?

Best Regards

sven
15 Sep 2010, 1:26 AM
Its an issue in your code. You should use the help forum for something like this.

The minimize method of the window fires the minimize event. As you call the minimize method again in that event, you have an endless loop which ends in an stackoverflow. You need to implement some other logic in that listener.