See javadoc of Activity#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/2.1/com/google/gwt/event/shared/HandlerRegistration.html>
instances
returned byEventBus.addHandler(com.google.gwt.event.shared.GwtEvent.Type,
H)<http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/event/shared/EventBus.html#addHandler(com.google.gwt.event.shared.GwtEvent.Type,
H)>.

So when you stop, then eventbus is "clean".

http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/activity/shared/Activity.html#start(com.google.gwt.user.client.ui.AcceptsOneWidget,
com.google.gwt.event.shared.EventBus)



<http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/activity/shared/Activity.html#start(com.google.gwt.user.client.ui.AcceptsOneWidget,
com.google.gwt.event.shared.EventBus)>

2011/5/9 Thomas Lefort <[email protected]>

> Hi,
>
> I use the ResettableEventBus passed to my activity in the start method
> to register my event handlers for the activity.
> The way my application works is that each time a "project" is loaded,
> the activity makes a call to the placeController goTo method to reload
> the activity with the right project id. This is all done within the
> same activity type.
> Before I can load the project I need to wait for resources to be
> loaded. Once they are loaded I can load the prject itself. I have a
> handler for that (using a resources loaded event). The problem is that
> when resources are loaded it is always the handler of the previous
> activity that is called (except for teh first one), as if the handlers
> were not properly unregistered when the activity stopped.
>
> I noticed the ResettableEventBus object is the same across all
> activities, I would have thought it'd be different. Also I don't call
> the removeHandlers as it is supposed to be called automatically when
> the activity is stopped.
> Could the problem be that I am calling a new activity within the same
> activity type?
>
> Has anybody encountered such a problem before?
>
> Thanks,
>
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> 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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
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