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 677649 - gtk[list,tree]store: fix transformation of GValues upon set
gtk[list,tree]store: fix transformation of GValues upon set
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-06-07 20:09 UTC by Cosimo Cecchi
Modified: 2012-06-07 20:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
liststore: fix transformation of GValues on set (1.85 KB, patch)
2012-06-07 20:09 UTC, Cosimo Cecchi
committed Details | Review
treestore: fix transformation of GValues on set (1.85 KB, patch)
2012-06-07 20:10 UTC, Cosimo Cecchi
committed Details | Review

Description Cosimo Cecchi 2012-06-07 20:09:55 UTC
See attached patches; the intended code path was actually never hit, but this probably was never really a problem using the objects from C.
Now that we can use GtkListStore and GtkTreeStore e.g. from GJS, the binding will pass in GValues that might need to be transformed.
Comment 1 Cosimo Cecchi 2012-06-07 20:09:57 UTC
Created attachment 215876 [details] [review]
liststore: fix transformation of GValues on set

There are three bugs here:
- we should check if the value type is transformable instead of being
  compatible, since that's all we care about in order to call
  g_value_transform()
- the check is only meaningful in the direction
  passed-in-type->column-type and not viceversa
- we should init the destination GValue to the column type before
  calling g_value_transform on it, or the destination type information
  will be missing and the method will fail

Thanks to Jasper St. Pierre and Colin Walters for all the help in
tracking this down.
Comment 2 Cosimo Cecchi 2012-06-07 20:10:00 UTC
Created attachment 215877 [details] [review]
treestore: fix transformation of GValues on set

There are three bugs here:
- we should check if the value type is transformable instead of being
  compatible, since that's all we care about in order to call
  g_value_transform()
- the check is only meaningful in the direction
  passed-in-type->column-type and not viceversa
- we should init the destination GValue to the column type before
  calling g_value_transform on it, or the destination type information
  will be missing and the method will fail

Thanks to Jasper St. Pierre and Colin Walters for all the help in
tracking this down.
Comment 3 Matthias Clasen 2012-06-07 20:26:17 UTC
Looks correct. I would really like to see a testcase added that exercises these code paths.
Comment 4 Cosimo Cecchi 2012-06-07 20:48:00 UTC
Attachment 215876 [details] pushed as e92e767 - liststore: fix transformation of GValues on set
Attachment 215877 [details] pushed as a24f756 - treestore: fix transformation of GValues on set

Pushed to master with a test case.