Re: Where to free dynamic allocated widgets, generated within signal handlers
- From: Kjell Ahlstedt <kjellahlstedt gmail com>
- To: Klaus Rudolph <lts-rudolph gmx de>
- Cc: gtkmm-list gnome org
- Subject: Re: Where to free dynamic allocated widgets, generated within signal handlers
- Date: Sat, 4 Jan 2020 11:55:50 +0100
I think
https://gitlab.gnome.org/GNOME/gtkmm-documentation/blob/gtkmm-3-24/examples/book/application/command_line_handling/exampleapplication.cc
contains a solution to your problem. See
ExampleApplication::create_window() and
ExampleApplication::on_window_hide().
Kjell
On 2020-01-04 00:43, Klaus Rudolph wrote:
Hi Daniel,
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.
OK, but no need to capture it as it is "this" in that case or I am wrong?
free(this) is so wildly wrong.
Yeahhhh!!! :-) Don't programmed in C for many years. No idea why I put
that to the sample as a comment...
delete(this) would also be wrong: in the dtor because it would
cause an infinite loop...
But it is not the dtor, it is in the sig handler for the delete event.
Is that the safe way?
Regards
Klaus
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]