wxBoxSizer question (Memory Leak potential) Topic is solved

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
DavidKlecker
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 232
Joined: Sun Nov 29, 2009 10:35 am

wxBoxSizer question (Memory Leak potential)

Post by DavidKlecker »

I used DialogBlocks to render code for a dialog box and in the CreateControls method it builds there are a lot of references to wxBoxSizer and other related Static fields that have the following code

Code: Select all

wxBoxSizer *BoxSizer1 = new wxBoxSizer(...); //the ellipse is just to show a parameter exists but is not important. 
My question is, I cannot call delete BoxSizer1 at the end of this method or I will crash the application? Does wxWidgets handle the deletion of BoxSizer1? I don't see how but maybe I'm missing something.

I realize the quickest solution here is just put the wxBoxSizer *BoxSizer1 in the class Object created rather than have it local to the method but if wxWidgets does handle this somehow it does save the work.

Thanks!
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

When a frame is deleted, all of its content is automatically deleted along it (recursively), so as long as the sizer is assigned to some frame there should be no leaks
"Keyboard not detected. Press F1 to continue"
-- Windows
DavidKlecker
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 232
Joined: Sun Nov 29, 2009 10:35 am

Post by DavidKlecker »

Ah okay. Thanks
Post Reply