I have a custom widget. Inside it I create some other widgets, without tellingt them the parent.
When the main widget is closed, whats happen with them ? Are they auto-deleted or destroyed ? If they are not destroyed, have I memory leaks?
Thanks.
I have a custom widget. Inside it I create some other widgets, without tellingt them the parent.
When the main widget is closed, whats happen with them ? Are they auto-deleted or destroyed ? If they are not destroyed, have I memory leaks?
Thanks.
are these widgets arranged within a layout? in that case, they get reparented automatically which means they get destroyed when the layout gets destroyed. If you do't have a layout, they will not be destroyed - c++ does not have any garbage collector like java. And yes, then you have memory leaks (assuming you create the widgets with "new" and don't use smart pointers to store them).
hth,
Felix
tonnot (13th February 2012)
Bookmarks