After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 132716 - OptionMenu::set_history() invalidates MenuList::Item::get_child() with NULL pointer
OptionMenu::set_history() invalidates MenuList::Item::get_child() with NULL p...
Status: RESOLVED NOTABUG
Product: gtkmm
Classification: Bindings
Component: general
2.2
Other Linux
: Normal major
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2004-01-27 22:46 UTC by Diana Esch- Mosher
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test case (766 bytes, text/plain)
2004-08-25 04:42 UTC, Michael J M Thomson
Details

Description Diana Esch- Mosher 2004-01-27 22:46:54 UTC
set_history() on an option menu with ImageMenuElems causes the label
pointer to be set to NULL



colorClassMenu = manage(new Gtk::OptionMenu())
baseMenu = manage(new Gtk::Menu());
 ......snip.......

Gtk::Label *classLabel =
dynamic_cast<Gtk::Label*>(baseMenu->items()[0].get_child());
    cout << "MENU CLASS 0 before " << classLabel << endl;
    classLabel = dynamic_cast<Gtk::Label*>(baseMenu->items()[1].get_child());
    cout << "MENU CLASS 1 before " << classLabel << endl;

    colorClassMenu->set_history(0);
    cout << "HIST" << colorClassMenu->get_history() << endl;

    classLabel = dynamic_cast<Gtk::Label*>(baseMenu->items()[0].get_child());
    cout << "MENU CLASS 0 after set 0 " << classLabel << endl;
    classLabel = dynamic_cast<Gtk::Label*>(baseMenu->items()[1].get_child());
    cout << "MENU CLASS 1 after set 0  " << classLabel << endl;

    colorClassMenu->set_history(1);
    cout << "HIST" << colorClassMenu->get_history() << endl;

    classLabel = dynamic_cast<Gtk::Label*>(baseMenu->items()[0].get_child());
    cout << "MENU CLASS 0 after set 1 " << classLabel << endl;
    classLabel = dynamic_cast<Gtk::Label*>(baseMenu->items()[1].get_child());
    cout << "MENU CLASS 1 after set 1 " << classLabel << endl;


-----------------------------------------
MENU CLASS 0 before 0x8144a78
MENU CLASS 1 before 0x8145338
HIST0
MENU CLASS 0 after set 0 0
MENU CLASS 1 after set 0  0x8145338
HIST0
MENU CLASS 0 after set 1 0x8144a78
MENU CLASS 1 after set 1 0

configuration data:

[voldemort]~/WORK/zing: rpm -qa | grep gtk
gtkglarea-1.2.2-16
gtkhtml2-devel-2.2.0-6
gtkmm2-devel-2.2.3-fr1
gtkmm2-2.2.3-fr1
gtk-engines-0.12-2.0
authconfig-gtk-4.3.7-1
gtk+-1.2.10-27.1
gnome-python2-gtkhtml2-1.99.14-5
gtkam-0.1.7-6
gtk2-devel-2.2.4-4.0
gtk2-engines-2.2.0-2
gtkam-gimp-0.1.7-6
usermode-gtk-1.68-5
gtkhtml2-2.2.0-6
gtkhtml3-3.0.9-4
gtk2-2.2.4-4.0
pygtk-0.6.9-7.ximian.2
pygtk2-devel-1.99.16-8
gtk+-devel-1.2.10-27.1
gtk-doc-1.1-3.0
pygtk2-1.99.16-8
pygtk2-libglade-1.99.16-8
Comment 1 Murray Cumming 2004-03-18 18:25:13 UTC
Can we have a simple-as-possible, compilable, test case please?
Comment 2 Michael J M Thomson 2004-08-25 04:42:38 UTC
Created attachment 30911 [details]
Test case

Test case
Comment 3 Michael J M Thomson 2004-08-28 06:23:53 UTC
On further inspection, this is because of a bug in the Gtk C API.
Comment 4 Michael J M Thomson 2004-08-28 09:56:22 UTC
In fact, close this bug, it is how Gtk is supposed to work -- the menuitem's
child seems to 'disappear' because it is just reparented to the optionmenu when
it is the actively displayed item.
Comment 5 Murray Cumming 2004-10-25 11:39:37 UTC
OK. Thanks.