Delete Window object after removeChild method. [solved]

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

Toge
Just popping in
Just popping in
Posts: 12
Joined: Thu Jan 22, 2009 21:59

Delete Window object after removeChild method. [solved]

Postby Toge » Wed Apr 08, 2009 22:11

Hello.
I have a Window in other Window. If I remove the Window from the Window ( :roll: ), should I delete the removed window? must I delete the removed window?


Code: Select all

Window* win1 = ...

...

Window* win2 = new Window("TaharezLook/StaticText","win2");
win1->addChildWindow(win2);

...

win1->removeChildWindow("win2");
delete win;



Thanks.
Last edited by Toge on Wed Apr 08, 2009 22:32, edited 1 time in total.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Wed Apr 08, 2009 22:19

Hi,

First you have to remember that CEGUI manages objects for you, this means that - with very few exceptions - you do not call 'new' or 'delete' for CEGUI objects directly, you create and destroy them via some 'manager' or factory object (so for a Window, that's the WindowManager).

To answer the specific question, it depends ;) If you're never going to want that window again, then go ahead and destroy it. If you're likely to want it again at some time, just 'orphan' it for now and reacquire it later via WindowManager::getWindow.

Any window objects still around when CEGUI is shut-down will automatically be destroyed.

HTH

CE


Return to “Help”

Who is online

Users browsing this forum: No registered users and 15 guests