I've also posted this question in
Stackoverflow<http://stackoverflow.com/q/19966930/770519>.
Sorry to crosspost, but I wasn't sure of the best place to post.
I've got a GWT 2.4 app where I'm "swapping views" by switching out one
Composite widget on the RootPanel for another, using the usual
RootPanel.get().clear() and RootPanel.get().add(newWidget) to remove and
add, respectively.
The first composite widget contains a PasswordTextBox. It listens for the
Enter keypress, which triggers the swap. Nothing too fancy:
getDisplay().getPasswordBoxForKeyPresses().addKeyPressHandler(new
KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
swapWidgets(); // clear RootPanel and add new widget
}
}
});
The problem is that there is a DOM memory leak: after
RootPanel.get().clear() is called, the old composite widget is stuck in the
detached DOM tree because the HTMLInputElement for the PasswordTextBox has
some strange reference to it which I cannot identify. I compiled at
style=detailed and started trying to drive down the tree to look a
reference to the element in JS. I'm pretty new with GWT, so it still isn't
obvious to me what's going on. So starting with the second line in the
retaining tree as in the screenshot below, I can see that lastEvent in
_2contains the
nativeKeyTarget listed at the top of tree. But where do I go from there?
<https://lh6.googleusercontent.com/-CXWLmgDgTnk/UoVhque2qKI/AAAAAAAAAAo/3UTK3DIBFLI/s1600/Screen+Shot+2013-11-14+at+3.12.28+PM.png>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.