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 417116 - Inconsistent Gnome::Gda::Value semantics
Inconsistent Gnome::Gda::Value semantics
Status: RESOLVED FIXED
Product: libgdamm
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2007-03-11 15:35 UTC by Armin Burgmeier
Modified: 2011-01-16 23:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make sure the value has the correct type before setting a new value (5.27 KB, patch)
2007-03-18 18:59 UTC, Armin Burgmeier
none Details | Review

Description Armin Burgmeier 2007-03-11 15:35:12 UTC
Gnome::Gda::Value has different set() overloads, of which most do just g_value_set_*. g_value_set_* does not allow changing the value's type, so calling set("foo") on an uninitialized value (or one that holds another type than G_TYPE_STRING) raises an error.

Other overloads use a gda_value_set_* function which does first unset the value and initialize it with the correct type again. Therefore, calling the set() overload that takes a GdaTime works on an uninitialized value. This is inconsistent and might confuse people.

I think this is easy to fix once we agree on what to do in all cases. Allowing the Value to change its type during its lifetime is preferable, I guess, so adding g_value_unset()/g_value_init() calls to the set() functions that use g_value_set*  might be enough.
Comment 1 Murray Cumming 2007-03-14 09:59:40 UTC
Yes, let's do what gda_value_set* does. Maybe we can check the type before changing it, to maybe be more efficient.

I wonder if C coders are meant to use the g_value_set_*() functions as well as the gda_value_set*() functions. This would then be confusing for them. But that would be a libgda bug.
Comment 2 Armin Burgmeier 2007-03-18 18:59:04 UTC
Created attachment 84837 [details] [review]
Make sure the value has the correct type before setting a new value

I can commit this if you are OK with it.

C coders have at least the gda_ vs. g_ prefix to differentiate between the two (in contrast to C++).
Comment 3 Murray Cumming 2007-03-19 07:53:45 UTC
Yes, this looks good. Please go aheahd.
Comment 4 Armin Burgmeier 2007-03-19 14:08:25 UTC
Patch committed.