Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - TheNess

#1
Hi there :)

First let me say that tgui is excellent and I really love its simplicity!

with that said, I have a voodoo exception that happens at rare occasions. basically I get "vector subscript out of range" when I call handleEvent(), from this code in Container.cpp:


void Container::focusWidget(Widget *const widget)
    {
        // Loop all the widgets
        for (unsigned int i = 0; i < m_Widgets.size(); ++i)
        {
            // Search for the widget that has to be focused
            if (m_Widgets[i].get() == widget)
            {
                // Only continue when the widget wasn't already focused
                if (m_FocusedWidget != i+1)
                {
                    // Unfocus the currently focused widget
                    if (m_FocusedWidget)
                    {
                        m_Widgets[m_FocusedWidget-1]->m_Focused = false; // <- EXCEPTION HERE.
                        m_Widgets[m_FocusedWidget-1]->widgetUnfocused();
                    }

                    // Focus the new widget
                    m_FocusedWidget = i+1;
                    widget->m_Focused = true;
                    widget->widgetFocused();
                }

                break;
            }
        }
    }


it comes from bool handleEvent(sf::Event event, bool resetView) (the last line of "return m_Container.handleEvent(event);"), and it usually happens when I call handleEvent() of the tgui manager and in the same frame I do some "show()" and "hide()" to windows (I have a level editor with tgui and it happens when I switch between tools and hide some windows and show others).

that's all I have on this bug at this moment. I'm trying to look deeper into it, so if you have any ideas or things I can try to narrow it down that will be great.


thanks,