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 534685 - Bin::add_label passes wrong parameters to Label constructor
Bin::add_label passes wrong parameters to Label constructor
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
2.12.x
Other All
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2008-05-24 21:14 UTC by Peter Wainwright
Modified: 2008-06-03 18:25 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
Patch against svn head (525 bytes, patch)
2008-06-02 12:40 UTC, Peter Wainwright
none Details | Review

Description Peter Wainwright 2008-05-24 21:14:17 UTC
Please describe the problem:
The order of arguments is inconsistent between Bin::add_label and Label::Label.

The former passes

Label* label = manage(new Label(str, mnemonic, x_align, y_align));

The latter expects mnemonic to be the last argument:

Label::Label(const Glib::ustring& label, float xalign, float yalign, bool mnemonic)

Unfortunately float and bool are convertible, so the compiler does not pick up the error, but it manifests at run-time with wrong alignments and (most notably) underscores being used to specify mnemonics when you did not intend it.



Steps to reproduce:
1. Create a menu
2. Use remove, and add_label to change the label on a menu item.  Use a string containing '_'.
3. Pop up the menu.


Actual results:
You will see that the '_' has been used to underline the following character as a mnemonic, although you did not intend this (the default value of "mnemonic" should be false).



Expected results:
Underscores should not be treated as mnemonics.

Does this happen every time?
Yes

Other information:
Comment 1 Murray Cumming 2008-06-02 08:26:53 UTC
Would you like to make a patch for this against svn?
Comment 2 Peter Wainwright 2008-06-02 12:40:51 UTC
Created attachment 111948 [details] [review]
Patch against svn head

OK, here's a patch
Comment 3 Murray Cumming 2008-06-02 21:11:07 UTC
Thanks. Committed to svn trunk. Please patch the ChangeLog in future.

Hopefully you can work around this before it appears in a tarball. I didn't even know that this method existed. I don't see what these Bin::add_*() methods are good for.
Comment 4 Peter Wainwright 2008-06-03 17:50:25 UTC
Thanks.  I don't consider myself a developer on this project, so I didn't think to patch the ChangeLog, sorry.

There is a lot of stuff in the GTK interface that is not obviously useful, but if you use it heavily you'll almost certainly come across a case where it is the only way to accomplish what you need to do.

I'm working on a GTK interface to the DDD debugger - I use these routines to change the labels on the popup menu which appears when you right-click on a function or variable name in the source window: so you get "Break at ...", "Print ...", "Display ...", and so on.  It saves having to tear down and rebuild the entire menu.

Comment 5 Murray Cumming 2008-06-03 18:25:34 UTC
I'm sure you'll be interested in the nemiver debugger project. It uses gtkmm.