How long does it take for a connection disconnect to work?

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

arrummzen
Just popping in
Just popping in
Posts: 7
Joined: Sat Jun 02, 2007 17:54

How long does it take for a connection disconnect to work?

Postby arrummzen » Wed Oct 31, 2007 05:44

After I disconnect my connection (via the Event::Connection object returned when I create it) I get a segfault from CEGUI:

Code: Select all

#0  0x00002b2bdfcdbe04 in CEGUI::Event::operator() () from /usr/lib/libCEGUIBase.so.1
#1  0x00002b2bdfd7591b in CEGUI::PushButton::onMouseButtonUp () from /usr/lib/libCEGUIBase.so.1
#2  0x00002b2bdfd10e86 in CEGUI::System::injectMouseButtonUp () from /usr/lib/libCEGUIBase.so.1


It looks like CEGUI is still trying to use the disconnected connection. Why must I do to fully disconnect the connection so that CEGUI does not try to call NULL?

Thank you for your time,
Arrummzen

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Wed Oct 31, 2007 09:24

The disconnection should be immediate, IIRC there is the possibility of issues if you disconnect from within a subscriber (or the subscriber being disconnected) on the same slot queue (that is, the same event).

If that's not what you're doing, could you post some snippet of code which gives the general context of what you're doing and somebody may be able to either spot the issue, or run a test of some kind (though that somebody will likely not be me ;) ).

arrummzen
Just popping in
Just popping in
Posts: 7
Joined: Sat Jun 02, 2007 17:54

Postby arrummzen » Wed Oct 31, 2007 17:02

Yea, I am disconnecting from within the subscriber on the same event. What is the suggested work around for this?

Code: Select all

void Event::operator()(EventArgs& args)
{
    SlotContainer::iterator iter(d_slots.begin());
    const SlotContainer::const_iterator end_iter(d_slots.end());

    // execute all subscribers, updating the 'handled' state as we go
    for (; iter != end_iter; ++iter)
        args.handled |= (*iter->second->d_subscriber)(args);
}

The above code is where the segfault occurs...
If no work around exists, perhaps it could be patched not to segfault when a handler disconnects itself?

Thank you for your time,
Arrummzen

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Thu Nov 01, 2007 12:09

The workaround, such that it is, involves maintaining a 'dead pool' of events which are to be disconnected once event processing is done.

So basically you have a list or array of Connection objects which you then iterate over disconnecting them once you are outside and handler code (which would normally be after all your 'inject' calls).

It's a bit wanky, I know :)


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 18 guests