Handlers added to the eventBus passed to the Activity.start method are not 
automatically deregistered for me.  I'm guessing it's my code, since I don't 
see much recent discussion about this.  I don't throw away my activities 
each time, so maybe that's my issue.  But reading the documentation makes me 
think this should work.

>From the javadoc of start:

Any handlers attached to the provided event bus will be de-registered when 
the activity is stopped, so activities will rarely need to hold on to the 
HandlerRegistration<http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/event/shared/HandlerRegistration.html>instances
 
returned by EventBus.addHandler(com.google.gwt.event.shared.GwtEvent.Type, 
H)<http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/event/shared/EventBus.html#addHandler(com.google.gwt.event.shared.GwtEvent.Type,
 
H)>.

However, if I have:

    @Override 
    public void start(AcceptsOneWidget panel, EventBus eventBus) { 
        panel.setWidget(view); 

        placeChangeRegistration = 
eventBus.addHandler(PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() { 
            @Override 
            public void onPlaceChange(PlaceChangeEvent event) {
                doSomething();
            } 
        }); 
    }

The handler is triggered even after onStop is called in my activity.  I also 
tried holding on to the registration (as above) and removing it in onStop 
and the handler is still called.

Does anyone have an idea of what I might be doing wrong?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/GjwWA8iibuQJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to