I'd say that cleaning up no longer needed handlers is just as important as closing open files when you're done or freeing memory that you've allocated. You won't notice the effects at first, but eventually you will. How soon depends on the cases under which your application creates handlers). Eventually, you'll see event delivery taking longer and longer because your event bus is busy notifying handlers that you don't care about anymore.
There's a reason why the handler manager goes to the trouble of returning a handler registration. There's no way for it to know that you're done with the handler. This is one of those cases where garbage collection wouldn't even help you because the handler manager has to hold a reference to the handler (unless you use weak references, but I'm pretty sure we don't have those in the JDK emulation layer). It's not too difficult to keep track of handler registrations. I often make a collection to hold them. Just add them all to the collection in your bind method and unregister everything (and clear the collection) in your unbind method. -Brian On Apr 12, 8:14 pm, rjcarr <rjc...@gmail.com> wrote: > If you no longer need the handler then yeah, you should remove it, > because you don't want to execute code blocks (onClick()) that are no > longer needed or used. > > But it certainly isn't required. > > On Apr 12, 2:32 pm, macagain <rgk...@gmail.com> wrote: > > > > > Is it required or even good practice to manually remove event handlers > > (say, on detach or unload)? I.e. keep the handlerRegistration around > > when returned from addHandler, then later call > > handlerManager.removeHandler(). > > > Of course in the old world of manually managing listener collections, > > one had to do it, but in the new world of HandlerManagers? -- 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-tool...@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.