GNOME Bugzilla – Bug 97741
When i compiled my gtkmm2 program and rut it, it throws segfault
Last modified: 2004-12-22 21:47:04 UTC
I use Anjuta 1.0.0. I started a new gtkmm2.0 project. Then, I copy/paste the code from my previus source file to the project and compiled it. Then, when i execudet the program, it sez: -------------------------------------------- (process:24466): GLib-GObject-CRITICAL **: gtype.c:1806: initialization assertion failed, use g_type_init() prior to this function (process:24466): GLib-GObject-CRITICAL **: gtype.c:1806: initialization assertion failed, use g_type_init() prior to this function (process:24466): Gtk-CRITICAL **: file gtktypeutils.c: line 40 (gtk_type_unique): assertion `GTK_TYPE_IS_OBJECT (parent_type)' failed (process:24466): GLib-GObject-CRITICAL **: gtype.c:1806: initialization assertion failed, use g_type_init() prior to this function (process:24466): GLib-GObject-CRITICAL **: file gtype.c: line 1872 (g_type_add_interface_static): assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed (process:24466): GLib-GObject-CRITICAL **: gtype.c:1806: initialization assertion failed, use g_type_init() prior to this function (process:24466): GLib-GObject-CRITICAL **: gtype.c:1806: initialization assertion failed, use g_type_init() prior to this function (process:24466): Gtk-CRITICAL **: file gtktypeutils.c: line 40 (gtk_type_unique): assertion `GTK_TYPE_IS_OBJECT (parent_type)' failed (process:24466): GLib-GObject-CRITICAL **: gtype.c:1806: initialization assertion failed, use g_type_init() prior to this function (process:24466): Gtk-CRITICAL **: file gtktypeutils.c: line 40 (gtk_type_unique): assertion `GTK_TYPE_IS_OBJECT (parent_type)' failed Segmentation fault --------------------------------------------------------- But when i compiled the previus source files without anjuta 1 and executed it, it was all ok. I don't know if this is a Anjuta 1.0 bug or a gtkmm-2 bug.
This is not a bug report until you supply some simple-as-possible test code. For general questions, please use the mailing list. My first guess would be that you haven't use Gtk::Main().
This Example: /********************************************/ #include <gtkmm.h> int main(int argc, char *argv[]) { Gtk::Window MainWindow; Gtk::Button button1("Hello!"); Gtk::Main kit(argc, argv); MainWindow.set_border_width(10); MainWindow.add(button1); Gtk::Main::run(MainWindow); return (0); } /****************************************/ , compiled with the help of Anjuta 1.0 will generate segfault.
You can't instantiate any gtkmm types *before* Gtk::Main has been instantiated. If you could we wouldn't have Gtk::Main.