[gtk+/gtk-3-4] liststore: fix transformation of GValues on set
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-4] liststore: fix transformation of GValues on set
- Date: Sun, 15 Jul 2012 16:59:30 +0000 (UTC)
commit d4b3e4d97b992cc6bc694e75867508fa3a789f41
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Jun 7 16:01:02 2012 -0400
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.
https://bugzilla.gnome.org/show_bug.cgi?id=677649
gtk/gtkliststore.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkliststore.c b/gtk/gtkliststore.c
index 763d1e1..2d99d5f 100644
--- a/gtk/gtkliststore.c
+++ b/gtk/gtkliststore.c
@@ -842,8 +842,7 @@ gtk_list_store_real_set_value (GtkListStore *list_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,
@@ -851,6 +850,8 @@ gtk_list_store_real_set_value (GtkListStore *list_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",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]