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

Kjell Ahlstedt via gtkmm-list <[email protected]>
Newsgroups gmane.comp.gnome.gtkmm
Message-ID <[email protected]>
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
>
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.