Re: How do you deal with dead EvenHandlers?

2010-12-22 Thread Jeff Schwartz
Hi Thomas, I hope you don't mind me following up again on this topic but after implementing onUnload to remove event handlers (which worked, of course) I realized that this approach is inappropriate for my application. The reason is that my application is basically modeless - meaning that I can

Re: How do you deal with dead EvenHandlers?

2010-12-21 Thread Thomas Broyer
Actually, because the EventHandler has a reference to the class that created it (in most cases, and it's true in your case), then as long as it is referenced by the EventBus, it won't be garbage collected, and neither will be its owner class. There's no dead event handler, only things that you

Re: How do you deal with dead EvenHandlers?

2010-12-21 Thread Jeff Schwartz
Hi Thomas, Yes, that would explain it and thank you very much for your input. About life cycle management, most of the classes in question are created anonymously as in my original example with the FluidTmpltDeletedGWTEvent.Handler. I guess I could keep a reference to the returned EventHandler

Re: How do you deal with dead EvenHandlers?

2010-12-21 Thread Jeff Schwartz
I've implemented onUnload to call removeHandler for the HandlerRegistration instance returned from SimpleEventBus.addHandler and it works perfectly. Thanks for pointing me in the right direction. By the way, Thomas, I was also wrong about my Composite's orphaned EventHandler not throwing an

How do you deal with dead EvenHandlers?

2010-12-20 Thread Jeff Schwartz
Hi, I am using the SimpleEventBus along with the GWTEvent in my application and I am wondering how one is supposed to deal with dead EventHandlers. For example, in my views I use numerous custom Composites that I've built. These Composites add themselves to the event bus via addHandler such as

Re: How do you deal with dead EvenHandlers?

2010-12-20 Thread Jeff Larsen
addHandler returns an interface HandlerRegistration. you'll notice a method in there removeHandler(). Call that and it will destroy the event from the event bus. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group,

Re: How do you deal with dead EvenHandlers?

2010-12-20 Thread Jeff Schwartz
Thanks, Jeff. Good name by the way:) I guess I should have mentioned that I am aware of the removeHandler method so I guess my question then really boils down to what happens if you don't call it? For example, suppose composite a has a reference to composite b and b calls addHandler for events