SubscriberSlot copy - segfault on cleanup

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

Not too shy to talk
Not too shy to talk
Posts: 25
Joined: Wed Nov 25, 2009 17:41

SubscriberSlot copy - segfault on cleanup

Postby KishukuOni » Sun Sep 01, 2013 19:56

I am having issues with SubscriberSlot in 0.8.2. The system is giving me a SEGFAULT on cleanup of the subscriber slot. (Which I cant trace back to a point in my code because its happening I believe during the static destruction of CEGUI)
I have a list of objects that need the same events. Each object contains multiple CEGUI::Window's and those windows also have some duplicate events. As these items are being created i am passing a SubscriberSlot to my object ctor and then subscribing the events as I create the windows. Maybe an example will make it clearer.

Code: Select all

Row::Row(SubscriberSlot click_event) {
    name = CreateTextWindow();
    name->subscribeEvent(Window::EventMouseClick, click_event);
    pic = CreateImageWindow();
    pic->subscribeEvent(Window::EventMouseClick, click_event);
    base = CreateEmptyWindow();
    base->subscribeEvent(WIndow::EventMouseClick, click_event);

With just two windows (sibling windows) it was working. As I add more I begin to have problems. If I have a parent and a child window with the same event the problem shows up every time. Here is where in the code the debugger shows me the issue is happening.

Code: Select all

void SubscriberSlot::cleanup()
    CEGUI_DELETE_AO d_functor_impl; // <== this line here
    d_functor_impl = 0;

I'm guessing that it is trying to delete the functor that has already been deleted. But I have no idea why. I am using the same pattern I was using in 0.7 and had no issues there.

Anyway, the obvious work-around was to not pass SubscriberSlots and instead use something like std::function.

Code: Select all

01/09/2013 15:37:08 (Std)    ---- Version: 0.8.2 (Build: Sep  1 2013 Debug GNU/Linux g++ 4.7.2 64 bit) ----
01/09/2013 15:37:08 (Std)    ---- Renderer module is: CEGUI::OpenGLRenderer - Official OpenGL based 2nd generation renderer module.  TextureTarget support enabled via FBO extension. ----
01/09/2013 15:37:08 (Std)    ---- XML Parser module is: CEGUI::RapidXMLParser - Official RapidXML based parser module for CEGUI ----
01/09/2013 15:37:08 (Std)    ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
01/09/2013 15:37:08 (Std)    ---- Scripting module is: None ----

Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 5 guests