---------- Forwarded message ---------
From:
Daniel Boles <dboles src gmail com>Date: Fri, 3 Jan 2020, 20:17
Subject: Re: Where to free dynamic allocated widgets, generated within signal handlers
To: Klaus Rudolph <
lts-rudolph gmx de>
it's not clear to me why the destructor would not be called in your example. i didn't test it.
anyway, if you need to, if you new a window somewhere, then you can connect to its ::delete-event and delete there via a captured pointer, being sure to return true so GTK does not then try to do anything with the dead win.
free(this) is so wildly wrong. firstly, things allocated with new must be deallocated with delete. free() is only for things from malloc(). secondly, delete(this) would also be wrong: in the dtor because it would cause an infinite loop... and anywhere because an object should never assume what mode of allocation it uses (there might be niche cases, but this isn't one).