Re: [Banshee-List] Hyena.Gui.Theatrics.Stage.ActorStep problem

I think the issue is that OnActorStep does "return handler (actor);"
but this only returns the value from the last delegate in the event's
delegate invocation list, so if there are two event handlers, the
first one's return value is ignored.

On Mon, Mar 10, 2008 at 2:12 PM, Aaron Bockover <abockover novell com> wrote:
> You're saying that if a handler has already been registered on the
>  event, to throw an exception in the add/remove accessors? Or are you
>  saying that only one handler should be allowed to be registered on the
>  event?
>  --Aaron
>  On Sun, 2008-03-09 at 22:57 -0400, Scott Peterson wrote:
>  > The Hyena.Gui.Theatrics.Stage.OnActorStep() method returns the result
>  > of the ActorStep handler (if it is not null). There is a potential bug
>  > here if more than one ActorStepHandlers are registered with the Stage:
>  > only the last handler to be registered will effect the outcome of
>  > OnActorStep(). This is unlikely, but possible, and if it were to
>  > happen to some poor dev, I bet they'd have a hell of a time figuring
>  > out what's wrong. Some possible solutions:
>  > * Change the ActorStep event to an ActorStepHandler property. This
>  > will make it perfectly clear that only one handler should be
>  > registered.
>  > * Require the passing of an ActorStepHandler in the Stage constructor.
>  > This has the same effect as the above.
>  > * Add custom add/remove blocks to the ActorStep event. If a handler
>  > has already been registered, throw an exception. Any error-prone code
>  > should encounter this exception as soon as it tries to run.
>  > * Add custom add/remove blocks to the ActorStep event to keep the
>  > registered handlers in a Collection. In OnActorStep, iterate through
>  > the collection and &= the results from each handler. This could also
>  > lead to potentially confusing behavior, but it makes more sense than
>  > the current system.
>  >
>  > As I see it, the choice is really over what syntax we prefer. If we
>  > want to go with the event syntax, I think the custom add/remove blocks
>  > and exception is the way to go. The downside is that people don't
>  > expect to get an exception just by registering an event handler. So it
>  > seems to me that a property is the best solution. Other opinions?
>  >
> _______________________________________________
>  Banshee-list mailing list
>  Banshee-list gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]