AlreadyExistsException when calling loadWindowLayout()?

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

some_name
Just popping in
Just popping in
Posts: 15
Joined: Sat Mar 10, 2007 00:12

AlreadyExistsException when calling loadWindowLayout()?

Postby some_name » Tue Mar 13, 2007 23:41

I've worked around my HandleClicked() problem by deferreing deletion of the window layout until the event injection has returned.

However, now I have a problem when showing a GUI for the second time. The flow control is something like:

window = WindowManager::getSingleton().loadWindowLayout(name);
guiSystem->setGUISheet(window);
delete window;
guiSystem->setGUISheet(NULL);
window = WindowManager::getSingleton().loadWindowLayout(name);

Obviously, this is not all in one function; there's time between the calls.

When getting to the second load call (which attempts to open a new copy of the previously deleted window), I get an AlreadyExistsException thrown from within the library. I use the SDK library installer, not built myself.

Apparently, the GUI system is holding on to some concept of the previously window/layout, even though I've deleted it and un-configured it from the GUI system -- I draw the conclusion that I need to do something more to clean up the loaded GUI before attempting to re-load it.

The documentation for loadWindowLayout() doesn't mention this exception at all; nor does the destructor for Window say anything about special cleanup requirements. The description for setGUISheet() is similarly unhelpful. What am I doing wrong?

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Wed Mar 14, 2007 08:49

Hi there,

you should not delete windows with 'delete' but rather by calling WindowManager::getSingleton().destroyWindow(window->getName()) for them.

HTH :)

some_name
Just popping in
Just popping in
Posts: 15
Joined: Sat Mar 10, 2007 00:12

Postby some_name » Wed Mar 14, 2007 23:54

You know, it would help if the documentation for the window class actually said that. It would help even more if the destructor for the window class was protected in that case.
But thanks for the info that the documentation lacked!


Return to “Help”

Who is online

Users browsing this forum: Google [Bot] and 10 guests