On 25 sep, 18:07, Alexey <inline_f...@yahoo.com> wrote:
> When registering handlers that may live on after the source widget is
> removed from GUI, is it acceptable to never explicitly release the
> handler relationship?  If it was plain Java, the answer would be yes,
> because the handler would not have references to the source and
> therefore would not preclude it from being garbage-collected.
> However, I'm not sure what happens in the GWT Javascript handler
> mechanism.

If I'm not mistaken (i.e. IIUC how event registration work in GWT), it
won't have side effects; i.e.
1. the actual JS function registered as an handler is the same for all
events
2. the EventListener (the Widget) is "attached" to the widget's
Element as a __listener expando property, which is set in
Widget#onAttach and reset to 'null' in Widget#onDetach
3. your handlers only live within the HandlerManager that backs the
widgets, i.e. a pure-JS object not bound to the DOM in any way
That way,
a. there won't be memory leaks
b. your handler will be garbage-collected at the same time as the
widget

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to