From: Cosimo Cecchi Date: Thu, 7 Jun 2012 20:05:27 +0000 (-0400) Subject: treestore: fix transformation of GValues on set X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~24^2~19772 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a24f7564b59a663e0208793fcfa53fa43a6e81da;p=gtk4.git 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. https://bugzilla.gnome.org/show_bug.cgi?id=677649 --- diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c index 773a2562d8..6271359fc4 100644 --- a/gtk/gtktreestore.c +++ b/gtk/gtktreestore.c @@ -853,8 +853,7 @@ gtk_tree_store_real_set_value (GtkTreeStore *tree_store, if (! g_type_is_a (G_VALUE_TYPE (value), priv->column_headers[column])) { - if (! (g_value_type_compatible (G_VALUE_TYPE (value), priv->column_headers[column]) && - g_value_type_compatible (priv->column_headers[column], G_VALUE_TYPE (value)))) + if (! (g_value_type_transformable (G_VALUE_TYPE (value), priv->column_headers[column]))) { g_warning ("%s: Unable to convert from %s to %s\n", G_STRLOC, @@ -862,6 +861,8 @@ gtk_tree_store_real_set_value (GtkTreeStore *tree_store, g_type_name (priv->column_headers[column])); return retval; } + + g_value_init (&real_value, priv->column_headers[column]); if (!g_value_transform (value, &real_value)) { g_warning ("%s: Unable to make conversion from %s to %s\n",