Re: How can I port this gtk construct to gtkmm?



On Wednesday 21 March 2007 12:55, Jef Driesen wrote:
> And the second was the automatic destruction of the dialog without the
> need to keep a pointer to it somewhere. Trying to do the same thing in
> C++ resulted either in a memory leak or immediate destruction of the
> dialog (when its variable goes out of scope).

If the dialog is a self-owning non-modal dialog constructed on free store, one 
common approach is for the signal handler for the hide signal (or the clicked 
signal for whatever button is intended to close the dialog) to call 'delete 
this'.  Self-owning objects such as non-modal dialogs are one of the (few) 
cases where calling 'delete this' correctly expresses the nature of the 
object and its place in the program structure.

Chris




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]