wxDialog Close clarification request

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
dcbdbis
Experienced Solver
Experienced Solver
Posts: 80
Joined: Sun Nov 24, 2013 9:49 pm
Location: Aurora, Colorado

wxDialog Close clarification request

Post by dcbdbis »

Good Evening All,

In typical C++, pointers to objects created with the new operator, must be manually deleted to prevent memory leaks.

For a wxDialog....I am requesting a clarification please. When a wxDialog is closed by the user - does this still apply? Or does the wxDialog self-destruct when it's closed - rendering it's pointer as garbage?

Or do we need to destroy the wxDialog's pointer manually?

Thanks!

Dave
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDialog Close clarification request

Post by doublemax »

Dialog can't destroy themselves, because they can - and usually should - be created on the stack. So, if you create it on the heap, you have to delete it.

https://docs.wxwidgets.org/trunk/classw ... alog_modal
Use the source, Luke!
dcbdbis
Experienced Solver
Experienced Solver
Posts: 80
Joined: Sun Nov 24, 2013 9:49 pm
Location: Aurora, Colorado

Re: wxDialog Close clarification request

Post by dcbdbis »

OK - that's a helpful tidbit...create them on the stack......

Thank You,

Dave
Post Reply