I'm using the game state architecture. When I pop a state, thats when I get a segfault with the GlobalEventSet singleton.
Heres my exit function for the state I'm popping.
Code: Select all
void IntroState::exit()
{
if ( _EditorGuiSheet )
{
CEGUI::WindowManager::getSingleton().destroyWindow( _EditorGuiSheet );
}
if ( _GUISystem )
{
delete _GUISystem;
_GUISystem = 0;
}
if ( _GUIRenderer )
{
delete _GUIRenderer;
_GUIRenderer = 0;
}
_SceneMgr->clearScene();
//!! Note: This is supposed to be mSceneMgr->destroyAllCameras(); for CVS head
_SceneMgr->removeAllCameras();
_Root->getAutoCreatedWindow() ->removeAllViewports();
}
The seg fault is happening from my mouseReleased method.
Code: Select all
void IntroState::mouseReleased ( MouseEvent *e )
{
CEGUI::System::getSingleton().injectMouseButtonUp(
convertOgreButtonToCegui( e->getButtonID() ) );
e->consume();
}
Heres the traceback
Code: Select all
#0 0xffffe410 in ?? ()
#1 0xbf8fc648 in ?? ()
#2 0x00000006 in ?? ()
#3 0x00004e26 in ?? ()
#4 0xb70d4b59 in raise () from /lib/tls/libc.so.6
#5 0xb70d61d1 in abort () from /lib/tls/libc.so.6
#6 0xb70ce621 in __assert_fail () from /lib/tls/libc.so.6
#7 0xb73df4fb in CEGUI::GlobalEventSet::getSingleton ()
from /usr/lib/libCEGUIBase.so.0
#8 0xb73cb8b1 in CEGUI::EventSet::fireEvent ()
from /usr/lib/libCEGUIBase.so.0
#9 0xb7445d3e in CEGUI::Window::onMouseButtonUp ()
from /usr/lib/libCEGUIBase.so.0
#10 0xb745c2e6 in CEGUI::ButtonBase::onMouseButtonUp ()
from /usr/lib/libCEGUIBase.so.0
#11 0xb74c50d6 in CEGUI::PushButton::onMouseButtonUp ()
from /usr/lib/libCEGUIBase.so.0
#12 0xb741eb45 in CEGUI::System::injectMouseButtonUp ()
from /usr/lib/libCEGUIBase.so.0
#13 0x0804e06a in IntroState::mouseReleased (this=0x8051620, e=0x81a30c8)
at /home/sermcgregor/work/root/gamestatedesign/src/IntroState.cpp:169
#14 0x0804bef3 in GameManager::mouseReleased (this=0x8067be8, e=0x81a30c8) at /home/sermcgregor/work/root/gamestatedesign/src/GameManager.cpp:182
#15 0xb7d5b8f4 in Ogre::MouseTarget::processMouseEvent ()
from /usr/lib/libOgreMain.so.4
#16 0xb7cd3285 in Ogre::EventProcessor::processEvent ()
from /usr/lib/libOgreMain.so.4
#17 0xb7cd31d0 in Ogre::EventProcessor::frameStarted ()
from /usr/lib/libOgreMain.so.4
#18 0xb7dd76a8 in Ogre::Root::_fireFrameStarted ()
from /usr/lib/libOgreMain.so.4
#19 0xb7dd787b in Ogre::Root::_fireFrameStarted ()
from /usr/lib/libOgreMain.so.4
#20 0xb7dd7ce0 in Ogre::Root::renderOneFrame ()
from /usr/lib/libOgreMain.so.4
#21 0xb7dd7c7e in Ogre::Root::startRendering ()
from /usr/lib/libOgreMain.so.4
#22 0x0804b92c in GameManager::start (this=0x8067be8, state=0x8051620) at /home/sermcgregor/work/root/gamestatedesign/src/GameManager.cpp:72
#23 0x0804ed36 in main (argc=1, argv=0xbf8fcdc4)
at /home/sermcgregor/work/root/gamestatedesign/src/Main.cpp:42
I also have a keyboard event that does the same thing but it doesn't crash.
Heres the error it gives me when it segfaults on the mouse click:
Code: Select all
gamestatedesign: ../include/CEGUISingleton.h:66: static T& CEGUI::Singleton<T>::getSingleton() [with T = CEGUI::GlobalEventSet]: Assertion `ms_Singleton' failed.
/bin/sh: line 1: 22168 Aborted ./src/gamestatedesign
Press Enter to continue!
