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 follows:


MySimpleEventBus.getInstance().addHandler(FluidTmpltDeletedGWTEvent.TYPE,
                new FluidTmpltDeletedGWTEvent.Handler() {

            @Override
            public void onFluidTmpltDeleted(FluidTmpltDeletedGWTEvent event)
{
                int i = fluids.indexOf(event.getFluidTmplt());
                fluids.remove(i);
                createPurchaseItemTypeList();
                MySimpleEventBus.getInstance().fireEvent(new
PurchaseItemTypesListModifiedGWTEvent(types));
            }
        });

My question is what happens when the composite which makes the above call to
add the handler for the event no longer exists? As the references to these
composites can go in and out of scope and there is no way they know they are
going out of scope and there is no explicit destructor method where calls to
remove the handlers can be made won't this cause EventHandler to throw a
null pointer exception later on when it fires the event to its handlers?
I've looked at the source code for SimpleEventBus and GWTEvent and it
appears that it would cause an UmbrellaException to be thrown. My app is
running fine in development and production and it hasn't thrown any
exception related to dead event handlers so maybe I am worrying over nothing
but then again... Am I misreading this and over complicating this or is this
something that I need to address?

Thanks in advance.

-- 
*Jeff Schwartz*

-- 
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.

Reply via email to