Gtk::Application::get_default segfault on exit
- From: David Mugnai <dvd+gtk gnx it>
- To: gtkmm-list gnome org
- Subject: Gtk::Application::get_default segfault on exit
- Date: Tue, 20 Jun 2017 21:22:26 +0000
According to the docs this code should be correct
#include <gtkmm.h>
class HelloWorld : public Gtk::Window {
public:
HelloWorld() : m_button("Hello World") {
m_button.signal_clicked().connect(sigc::mem_fun(*this, &HelloWorld::on_button_clicked));
add(m_button);
m_button.show();
}
protected:
void on_button_clicked() {
Gtk::Application::get_default();
}
Gtk::Button m_button;
};
int main() {
auto app = Gtk::Application::create();
HelloWorld helloworld;
app->run(helloworld);
return 0;
}
but it segfaults when closing the window (in app->run()) if "Gtk::Application::get_default();" has been
called.
gtkmm version is 3.22.0 (as shipped by Ubuntu 17.04)
ii libgtk-3-0:amd64 3.22.11-0ubuntu3 amd64 GTK+ graphical user interface
library
ii libgtk-3-bin 3.22.11-0ubuntu3 amd64 programs for the GTK+ graphical
user interface library
ii libgtk-3-common 3.22.11-0ubuntu3 all common files for the GTK+ graphical
user interface library
ii libgtk-3-dev:amd64 3.22.11-0ubuntu3 amd64 development files for the GTK+
library
ii libgtk-3-doc 3.22.11-0ubuntu3 all documentation for the GTK+
graphical user interface library
ii libgtkmm-3.0-1v5:amd64 3.22.0-1 amd64 C++ wrappers for GTK+ (shared
libraries)
ii libgtkmm-3.0-dev:amd64 3.22.0-1 amd64 C++ wrappers for GTK+ (development
files)
ii libgtkmm-3.0-doc 3.22.0-1 all C++ wrappers for GTK+
(documentation)
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?
Regards,
david
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]