[gtkmm] Menu destructor problems.
- From: jlm <jsado_sc1 earthlink net>
- To: gtkmm-list gnome org
- Subject: [gtkmm] Menu destructor problems.
- Date: 21 Jan 2003 17:51:44 -0500
I am working on porting my gtkmm 1.2.x program to 2.2.0. I was getting
weird errors while closing a dialog box and I've tracked it down to the
option menu that I have in the dialog box. Here are the errors I am
getting with my program:
(lt-color_dialog_test:1070): GLib-GObject-WARNING **: instance of
invalid non-instantiatable type `<invalid>'
(lt-color_dialog_test:1070): GLib-GObject-CRITICAL **: file gsignal.c:
line 2300 (g_signal_handlers_disconnect_matched): assertion
`G_TYPE_CHECK_INSTANCE (instance)' failed
(lt-color_dialog_test:1070): Gtk-CRITICAL **: file gtkoptionmenu.c: line
247 (gtk_option_menu_detacher): assertion `GTK_IS_OPTION_MENU (widget)'
failed
The third error is what helped me track this down to the option menu. I
have been playing with this for a while and I have come up with a small
program that mostly creates this error. The first two messages above are
printed out, but the third is not. It seg-faults before getting that
far. At first the test program ran fine, and I couldn't figure out why
it worked but my application doesn't. Then I changed from packing menu
items into the menu by using the append function to instead using the
push_back function of Gtk::Menu::MenuList. Now I see the errors with my
test program.
My application uses the append function and it gives the errors, by
switching to the push_back function it also gives the same errors. Below
is a backtrace after running the example program in gdb:
#0 0x405f8aae in g_data_set_internal () from /usr/lib/libglib-2.0.so.0
#1 0x405f8de3 in g_datalist_id_set_data_full () from
/usr/lib/libglib-2.0.so.0
#2 0x405c1d45 in g_object_real_dispose () from
/usr/lib/libgobject-2.0.so.0
#3 0x4034b6bb in gtk_object_dispose () from
/usr/lib/libgtk-x11-2.0.so.0
#4 0x403e4be5 in gtk_widget_dispose () from
/usr/lib/libgtk-x11-2.0.so.0
#5 0x4017898b in Gtk::Widget_Class::dispose_vfunc_callback(_GObject*)
() from /usr/lib/libgtkmm-2.0.so.1
#6 0x405c1def in g_object_last_unref () from
/usr/lib/libgobject-2.0.so.0
#7 0x4013f419 in Gtk::Object::_destroy_c_instance() () from
/usr/lib/libgtkmm-2.0.so.1
#8 0x4013f6a4 in Gtk::Object::destroy_() () from
/usr/lib/libgtkmm-2.0.so.1
#9 0x4013914b in Gtk::MenuItem::~MenuItem() () from
/usr/lib/libgtkmm-2.0.so.1
#10 0x0804cf40 in ~test_window (this=0xbffff6a0) at
debug_optionmenu.cpp:31
#11 0x0804cd17 in main (argc=1, argv=0xbffff7d4) at
debug_optionmenu.cpp:33
#12 0x40751a44 in __libc_start_main () from /lib/libc.so.6
And here is the example program:
#include <gtkmm/optionmenu.h>
#include <gtkmm/menu.h>
#include <gtkmm/window.h>
#include <gtkmm/main.h>
class test_window : public Gtk::Window
{
Gtk::OptionMenu some_menu;
Gtk::MenuItem menu_one, menu_two;
Gtk::Menu the_menu;
public:
test_window();
};
test_window::test_window()
: menu_one("One"), menu_two("Two")
{
Gtk::Menu_Helpers::MenuList& menulist=the_menu.items();
menulist.push_back(menu_one);
menulist.push_back(menu_two);
// the_menu.append(menu_one);
// the_menu.append(menu_two);
some_menu.set_menu(the_menu);
add(some_menu);
show_all();
}
int main(int argc, char *argv[])
{
Gtk::Main main_runner(argc, argv);
test_window foo;
main_runner.run(foo);
return(0);
}
The program crashes when you close the window. If you uncomment the two
append functions and comment out the push_back functions the program no
longer exhibts this error.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]