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



On 20 June 2017 at 22:22, David Mugnai <dvd+gtk gnx it> wrote:
but it segfaults when closing the window (in app->run()) if "Gtk::Application::get_default();" has been called. 
[...] 
Valgrind reports several invalid reads, this is the first one:

   ==26534== Invalid read of size 8
   ==26534==    at 0x77CD5FB: g_application_run (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5200.0)
   ==26534==    by 0x5129081: Gtk::Application::run(Gtk::Window&) (in /usr/lib/x86_64-linux-gnu/libgtkmm-3.0.so.1.1.0)
   ==26534==    by 0x44B032: main (main.cpp:25)
   ==26534==  Address 0x11c333c8 is 264 bytes inside a block of size 288 free'd
   ==26534==    at 0x4C2ED5B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   ==26534==    by 0x8458321: g_type_free_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5200.0)
   ==26534==    by 0x845C09F: g_value_unset (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5200.0)
   ==26534==    by 0x844F8D2: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5200.0)
   ==26534==    by 0x844FC6E: g_signal_emit (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5200.0)
   ==26534==    by 0x77CD5FA: g_application_run (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5200.0)
   ==26534==    by 0x5129081: Gtk::Application::run(Gtk::Window&) (in /usr/lib/x86_64-linux-gnu/libgtkmm-3.0.so.1.1.0)
   ==26534==    by 0x44B032: main (main.cpp:25)
   ==26534==  Block was alloc'd at
   ==26534==    at 0x4C2DB2F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   ==26534==    by 0x86C7988: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5200.0)
   ==26534==    by 0x86DFED2: g_slice_alloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5200.0)
   ==26534==    by 0x86E04FD: g_slice_alloc0 (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5200.0)
   ==26534==    by 0x8458058: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5200.0)
   ==26534==    by 0x8439EAA: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5200.0)
   ==26534==    by 0x843B8A7: g_object_newv (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5200.0)
   ==26534==    by 0x605EB89: Glib::Object::Object(Glib::ConstructParams const&) (in /usr/lib/x86_64-linux-gnu/libglibmm-2.4.so.1.3.0)
   ==26534==    by 0x5AFA741: Gio::Application::Application(Glib::ConstructParams const&) (in /usr/lib/x86_64-linux-gnu/libgiomm-2.4.s
   o.1.3.0)
   ==26534==    by 0x51293DD: Gtk::Application::Application(Glib::ustring const&, Gio::ApplicationFlags) (in /usr/lib/x86_64-linux-gnu
   /libgtkmm-3.0.so.1.1.0)
   ==26534==    by 0x51294ED: Gtk::Application::create(Glib::ustring const&, Gio::ApplicationFlags) (in /usr/lib/x86_64-linux-gnu/libg
   tkmm-3.0.so.1.1.0)
   ==26534==    by 0x44AFF6: main (main.cpp:23)

It's a bug in gtk, gtkmm or in the Ubuntu packages?

My guess: none of the above. Rather, due to your version of glibmm missing this patch:

https://git.gnome.org/browse/glibmm/commit/gio/src/application.hg?id=bd988a80db4b05b0b1bbee4f68666d815d7641f8

meaning that the returned Application is not referenced, and can be double-freed; see the Bugzilla.
 



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