Crash on getSingleton

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

danharibo
Just popping in
Just popping in
Posts: 12
Joined: Tue Sep 19, 2006 15:05

Crash on getSingleton

Postby danharibo » Tue Apr 10, 2007 19:23

Code: Select all

CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
Just causes an assertion error. What the hell
mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);
CEGUI::WindowManager* mGUImngr = new CEGUI::WindowManager();
mGUISystem = new CEGUI::System(mGUIRenderer);
mEditorGuiSheet = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "root");

CEGUI::System::getSingleton().setGUISheet(mEditorGuiSheet);

User avatar
Levia
Quite a regular
Quite a regular
Posts: 83
Joined: Mon May 22, 2006 18:25
Location: Bergen op zoom, The Netherlands
Contact:

Postby Levia » Tue Apr 10, 2007 20:47

Dont instantiate the WindowManager, the System constructor does that for you.

Code: Select all

mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);
mGUISystem = new CEGUI::System(mGUIRenderer);
mEditorGuiSheet = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "root");

CEGUI::System::getSingleton().setGUISheet(mEditorGuiSheet);
Image
Image

danharibo
Just popping in
Just popping in
Posts: 12
Joined: Tue Sep 19, 2006 15:05

Postby danharibo » Tue Apr 10, 2007 21:04

Still Crashes.

User avatar
Levia
Quite a regular
Quite a regular
Posts: 83
Joined: Mon May 22, 2006 18:25
Location: Bergen op zoom, The Netherlands
Contact:

Postby Levia » Tue Apr 10, 2007 21:11

Can you specify on what line it crashes? Perhaps the System is not created properly.
Image

Image

danharibo
Just popping in
Just popping in
Posts: 12
Joined: Tue Sep 19, 2006 15:05

Postby danharibo » Tue Apr 10, 2007 21:20

It Crashes here:

Code: Select all

      Cbaseeditor* mEditor = new Cbaseeditor(mSceneMgr,CEGUI::WindowManager::getSingleton().getWindow("root"));

According to the debugger, but i'm guessing this is the cause:

Code: Select all

   CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();

User avatar
Levia
Quite a regular
Quite a regular
Posts: 83
Joined: Mon May 22, 2006 18:25
Location: Bergen op zoom, The Netherlands
Contact:

Postby Levia » Tue Apr 10, 2007 21:27

Where is that line then? I mean, can you paste some more code?
Image

Image

danharibo
Just popping in
Just popping in
Posts: 12
Joined: Tue Sep 19, 2006 15:05

Postby danharibo » Tue Apr 10, 2007 21:31

Code: Select all

void Cbaseeditor::DrawMenu()
{
   ////Grab the CEGUI Window Manager
   CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();

   //Draws a CEGUI driven MENU.
   CEGUI::PushButton* SaveButton = (CEGUI::PushButton*)wmgr.createWindow("TaharezLook/Button", (CEGUI::utf8*)"Save");
   mEditorGuiSheet->addChildWindow(SaveButton);
   SaveButton->setPosition(CEGUI::UVector2(cegui_reldim(0.35f), cegui_reldim( 0.45f)));
   SaveButton->setSize(CEGUI::UVector2(cegui_reldim(0.35f), cegui_reldim( 0.1f)));
   SaveButton->setText("Save");
   //Register Events for said elements
   SaveButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Cbaseeditor::SaveMap,this));

}

but it crashes at the constructor, when it tries to getSingleton for the windowManager

User avatar
Levia
Quite a regular
Quite a regular
Posts: 83
Joined: Mon May 22, 2006 18:25
Location: Bergen op zoom, The Netherlands
Contact:

Postby Levia » Tue Apr 10, 2007 21:37

Are you sure you call new CEGUI::System before you call that getSingleton for the windowmanager?

Try

Code: Select all

CEGUI::WindowManager * mWndMgr = CEGUI::WindowManager::getSingletonPtr();

aswell.
Can you show me the constructor of that class?
Image

Image

danharibo
Just popping in
Just popping in
Posts: 12
Joined: Tue Sep 19, 2006 15:05

Postby danharibo » Wed Apr 11, 2007 12:42

Code: Select all

      Cbaseeditor* mEditor = new Cbaseeditor(mSceneMgr,CEGUI::WindowManager::getSingletonPtr()->getWindow("root"));
Still Crashes here!

Code: Select all

Cbaseeditor::Cbaseeditor(Ogre::SceneManager* temp,CEGUI::Window* mGuiRoot)
{
   //Save the SceneMgr
   mSceneMgr = temp;
   Verstring = "Version 0.1.1a";
   Ogre::LogManager::getSingleton().logMessage("-----------------------");
   Ogre::LogManager::getSingleton().logMessage("-- Cbaseeditor --------");
   Ogre::LogManager::getSingleton().logMessage("Version: "+Verstring);
   Ogre::LogManager::getSingleton().logMessage("-- Initalizing Editor -");
   Ogre::LogManager::getSingleton().logMessage("-----------------------");
   //Load the Objects
   LoadResOdef();
   mEditorGuiSheet = mGuiRoot;
   //Show the load map Gui
   DrawMenu(); //We need this to Load our Main GUI

}

User avatar
Levia
Quite a regular
Quite a regular
Posts: 83
Joined: Mon May 22, 2006 18:25
Location: Bergen op zoom, The Netherlands
Contact:

Postby Levia » Wed Apr 11, 2007 13:05

Ok, are you sure CEGUI::System is created? Are there errors in the cegui.log?
Image

Image

danharibo
Just popping in
Just popping in
Posts: 12
Joined: Tue Sep 19, 2006 15:05

Postby danharibo » Wed Apr 11, 2007 13:29

05/04/2007 14:46:57 (InfL1) Attempting to create Font from the information specified in file 'bluehighway-12.font'.
05/04/2007 14:46:57 (Error) Exception: FontManager::createFont - The value for the Font:Type attribute 'Dynamic' is unknown.
05/04/2007 14:46:57 (Error) FontManager::createFont - loading of Font from file 'bluehighway-12.font' failed.

And I'm pretty sure System is being created

User avatar
Levia
Quite a regular
Quite a regular
Posts: 83
Joined: Mon May 22, 2006 18:25
Location: Bergen op zoom, The Netherlands
Contact:

Postby Levia » Wed Apr 11, 2007 13:31

Are you sure that exception isnt causing CEGUI to crash? Where are you creating the font? Are you sure the font file is there? Make sure the font loads correctly as most windows need it ;)
Image

Image

danharibo
Just popping in
Just popping in
Posts: 12
Joined: Tue Sep 19, 2006 15:05

Postby danharibo » Wed Apr 11, 2007 13:54

It Doesn't make sense because the font type is "FreeType"

User avatar
Levia
Quite a regular
Quite a regular
Posts: 83
Joined: Mon May 22, 2006 18:25
Location: Bergen op zoom, The Netherlands
Contact:

Postby Levia » Wed Apr 11, 2007 14:01

Try another font..some standard font..?
Image

Image

danharibo
Just popping in
Just popping in
Posts: 12
Joined: Tue Sep 19, 2006 15:05

Postby danharibo » Wed Apr 11, 2007 15:27

Ok i think it's working. but it still crashes. I'll have to get back to this as something more important has come up..


Return to “Help”

Who is online

Users browsing this forum: No registered users and 10 guests