Page 1 of 1

Events (un)subscriptions within other events processings

Posted: Tue Dec 13, 2005 13:24
by vinnythetrue
Hello all !

I'm currenlty using CEGUI in some GUI. But I recently stumbled over a problem : how to do in the good way some events subscriptions and unsubcriptions resulting from an event subscribed by the same widget...

The very problem is the Event::connectionOrdering map that is being modified during its browsing in the () operator method.

In the first place, to "correct" the issue, I added some basic index test to avoid passing beyond the reality when some event is purelly deleted from the list (on disconnection).

But now, a new configuration proves the inefficiency of such a solution : one event (the only the widget has subscribed to) is fired. During its process, it is disconnected (let's assume my work around could work so far) BUT, then, always during the same process, the widget subscribes the same event again (in fact, just the concerned instance is not the same). So when we're back in the () operator method, the map seems unchanged.

But the end() method test obviously fails, guiding us in another dimension...

Has anyone ever experienced these issues ? Does anything exist (despite my searches) in the CEGUI code to handle those special (un)subscriptions ?

Any help will be appreciated, thanks

Re: Events (un)subscriptions within other events processings

Posted: Thu Dec 15, 2005 17:04
by vinnythetrue
Come'on guys ! No one here experienced such issues ? :cry:

Re: Events (un)subscriptions within other events processings

Posted: Fri Dec 16, 2005 00:59
by lindquist
do the un-subscription safely outside of the event handler.

thing is you've hit a spot where CEGUI could use improvement, and this takes time.

you're free to submit a patch with a workaround. CEGUI is after all open-source...