Re: Where to free dynamic allocated widgets, generated within signal handlers



Am 04.01.20 um 12:26 schrieb Kjell Ahlstedt:

Hi Kjell,

I haven't tested, but I think you can override on_hide() and/or
on_delete_event() and "delete this;" there. Which one is called might
depend on how the window is hidden. on_hide() is called if the window is
hidden by pressing a button that calls hide(). I'm uncertain which
function is called if the window is closed by pressing the icon with a
cross, usually in the upper right-hand corner of the window.

I tested closing with cross on window an got both calls chained. I was
able to call delete in both functions. If I do it in the function which
is called first, the second function was not called as expected.

So I am fine with that. Valgrind did not detect any memory leaks or
wrong access on deleted memory, so I am in hope to stay with this
solution :-)

Thanks!


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