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 637018 - [GtkComboBoxText] Add checks for id-column/entry-text-column >= 0
[GtkComboBoxText] Add checks for id-column/entry-text-column >= 0
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkComboBox
2.91.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2010-12-11 14:24 UTC by Milan Bouchet-Valat
Modified: 2010-12-13 19:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[GtkComboBoxText] Add checks for id-column/entry-text-column >= 0 (2.12 KB, patch)
2010-12-11 14:25 UTC, Milan Bouchet-Valat
none Details | Review
[GtkComboBoxText] Add checks for id-column/entry-text-column >= 0 (2.13 KB, patch)
2010-12-11 14:44 UTC, Milan Bouchet-Valat
committed Details | Review

Description Milan Bouchet-Valat 2010-12-11 14:24:59 UTC
I've found myself in the situation where GtkComboBoxText from .ui files
didn't have id-column set, and the warnings I got were scary. Rather
than failing all over the place without explanation, better check for
it before. That's actually what the code does in these functions for all
other results.
Comment 1 Milan Bouchet-Valat 2010-12-11 14:25:02 UTC
Created attachment 176232 [details] [review]
[GtkComboBoxText] Add checks for id-column/entry-text-column >= 0

If the GtkComboBoxText doesn't have id-column or entry-text-column
set for some reason (value -1), better warn and return. Else, unrelated
assertions fail, and warnings from gtk_tree_model_get_column_type()
are printed, which are not really obvious.
Comment 2 Milan Bouchet-Valat 2010-12-11 14:44:16 UTC
Created attachment 176233 [details] [review]
[GtkComboBoxText] Add checks for id-column/entry-text-column >= 0

If the GtkComboBoxText doesn't have id-column or entry-text-column
set for some reason (value -1), better warn and return. Else, unrelated
assertions fail, and warnings from gtk_tree_model_get_column_type()
are printed, which are not really obvious.
Comment 3 Milan Bouchet-Valat 2010-12-11 14:45:17 UTC
Comment on attachment 176232 [details] [review]
[GtkComboBoxText] Add checks for id-column/entry-text-column >= 0

Of course I always need to post the wrong patch. New one uses g_return_val_if_fails() when needed.
Comment 4 Matthias Clasen 2010-12-13 15:16:46 UTC
Review of attachment 176233 [details] [review]:

Looks fine to me.
Comment 5 Milan Bouchet-Valat 2010-12-13 19:29:07 UTC
Attachment 176233 [details] pushed as 0290834 - [GtkComboBoxText] Add checks for id-column/entry-text-column >= 0