Re: Gtk::Application::get_default segfault on exit



Hi,

El 21/06/17 a las 00:04, Daniel Boles <dboles src gmail com> escribió:
meaning that the returned Application is not referenced, and can be
double-freed
specifically, if I'm right, it IS double-freed, plus you try to use it
after the 1st free:

   - you instantiate an unnamed RefPtr<Application> from get_default()
   - it immediately gets destroyed and decrements the reference count
   - which, because it didn't increment upon construction, causes the
   Application to get destroyed
   - then, on closing the window, it calls something on the Application to
   say 'one of your windows is gone', but there IS no Application!
   - boom.

Instanciating a named RefPtr<Application>, i get the same segmentation fault:

Glib::RefPtr<Gio::Application> app1 =  Gtk::Application::get_default();

Running the app from the command line, the terminal holds at the third click on the button.

Something similar happens to me in simple-netaid-gtk, the terminal holds after closing the window, i don't know why. So, added exit(0) to the destructor of the mainwindow, as you can see in window_main.cpp:

https://git.devuan.org/aitor_czr/simple-netaid-gtk/blob/master/src/window_main.cpp

Cheers,

  Aitor.





 


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