I have a simple question on one of the test. As I was making this correction I noticed that one of my test case comment is wrong.
The last remove test is actually incorrect (my comment). My question is what is the expected output of the last test. If you have 2 nested event bus, and if you call removeHandlers on the inner eventbus. Do you expect this remove to propagate to the outer event bus and remove it from its registration? If the answer is no it shouldn't propagate to the upper eventbus. The current setup will work nicely. The only weird thing is that the upper Resettable event bus thinks the event is still attached. If the answer is yes and the eventbus should be removed from the top. I came up with few ways to deal with the situation with pros and cons. 1. Recognize that you are wrapping a resettable event bus and don't record the registrationHandler at this level (simple pass through). On removeHandlers call removeHandhlers on the wrapped bus. * Pros: No new memory leak introduced. * Cons: If other wrapper is used this method will not work correctly. For example ResettableEventBus ->CountingEventBus -> ResettableEventBus -> SimpleEventBus. 2. Create a event that fires when things are removed from simple event bus (RemoveEvent of some sort). * Pros: Will work regardless of how complicated the nesting gets. * Cons: How do we know when to unregister our ResettableEventBus from this event? Simple solution is to unregister when nothing is left in the registration and add it back when something gets attached. Also more complex. Should user be allowed to attach to this event? Number 2 is definitely the best solution but rises many questions... Comment/Suggestion? http://gwt-code-reviews.appspot.com/1388804/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
