GNOME Bugzilla – Bug 677649
gtk[list,tree]store: fix transformation of GValues upon set
Last modified: 2012-06-07 20:48:05 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.
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.
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.
Looks correct. I would really like to see a testcase added that exercises these code paths.
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.