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



Am 04.01.20 um 11:55 schrieb Kjell Ahlstedt:
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().

Thanks Kjell!

What I see is, that the hide signal is delegated to some "other"
instance which calls the delete.


window->signal_hide().connect(sigc::bind<Gtk::Window*>(sigc::mem_fun(*this,
    &ExampleApplication::on_window_hide), window));

 void ExampleApplication::on_window_hide(Gtk::Window* window) {
delete window; }

My question still is: Is it safe to delete the "own" window the the
"own" signal handler and which signal handler is best to use for the
call to delete. Is it either on_hide() or on_delete_event( GdkEventAny* );

Thanks!
 Klaus


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