I have a button in a window which, when clicked, causes state to change, which causes the current GUI to be disposed and the GUI sheet reset to NULL. This causes the function injectMouseButtonUp() to crash sometime after the event has been dispatched and my action taken.
Is this a known bug? The documentation for the injection functions say nothing about it not being OK to change the GUI configuration inside any callbacks/events.
System::injectMouseButtonUp() crashes when deleting GUI
Moderators: CEGUI MVP, CEGUI Team
It is the inject that creates the HandleClicked callback.
The code looks something like the below.
Creation:
Handling/destruction:
As far as I can tell, this is all kosher (except, possibly, for the call to setGUISheet(0)).
I'm still trying to make this work without crashing, so any pointers on what I'm trying to do would be helpful.
The code looks something like the below.
Creation:
Code: Select all
window_ = CEGUI::WindowManager::getSingleton().loadWindowLayout(
(CEGUI::utf8*)layout);
BuildWidgetList(window_);
void MyClass::BuildWidgetList(CEGUI::Window *window) {
if (window->getType() == "TaharezLook/Button") {
CEGUI::Event::Connection conn = window->subscribeEvent(
CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&MyClass::HandleClicked, this));
connections_[window->getName()] = conn;
}
widgets_[window->getName()] = window;
for (size_t cnt = window->getChildCount(), i = 0; i < cnt; ++i) {
BuildWidgetList(window->getChildAtIdx(i));
}
}
mGUISystem->setGUISheet(window_);
gApplication->SetBuffered(true); // turns on event injection
Handling/destruction:
Code: Select all
bool MyClass::HandleClicked(CEGUI::EventArgs const &e) {
delete window_;
gApplication->SetBuffered(false);
mGUISystem->setGUISheet(0);
return true;
}
As far as I can tell, this is all kosher (except, possibly, for the call to setGUISheet(0)).
I'm still trying to make this work without crashing, so any pointers on what I'm trying to do would be helpful.
Who is online
Users browsing this forum: No registered users and 10 guests