gtk+ r20287 - in branches/gtk-2-12: . gtk
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r20287 - in branches/gtk-2-12: . gtk
- Date: Mon, 2 Jun 2008 22:19:22 +0000 (UTC)
Author: matthiasc
Date: Mon Jun 2 22:19:21 2008
New Revision: 20287
URL: http://svn.gnome.org/viewvc/gtk+?rev=20287&view=rev
Log:
Bug 530146 - Setting non-string tooltip with
gtk_tree_view_set_tooltip_column() segfaults
* gtk/gtktreeview.c (gtk_tree_view_set_tooltip_query_cb): use
gtk_tree_model_get_value() and explicitly transform the value to a
string before setting it as tooltip.
Modified:
branches/gtk-2-12/ChangeLog
branches/gtk-2-12/gtk/gtktreeview.c
Modified: branches/gtk-2-12/gtk/gtktreeview.c
==============================================================================
--- branches/gtk-2-12/gtk/gtktreeview.c (original)
+++ branches/gtk-2-12/gtk/gtktreeview.c Mon Jun 2 22:19:21 2008
@@ -15589,7 +15589,8 @@
GtkTooltip *tooltip,
gpointer data)
{
- gchar *str;
+ GValue value = { 0, };
+ GValue transformed = { 0, };
GtkTreeIter iter;
GtkTreePath *path;
GtkTreeModel *model;
@@ -15601,19 +15602,34 @@
&model, &path, &iter))
return FALSE;
- gtk_tree_model_get (model, &iter, tree_view->priv->tooltip_column, &str, -1);
+ gtk_tree_model_get_value (model, &iter,
+ tree_view->priv->tooltip_column, &value);
- if (!str)
+ g_value_init (&transformed, G_TYPE_STRING);
+
+ if (!g_value_transform (&value, &transformed))
{
+ g_value_unset (&value);
gtk_tree_path_free (path);
+
+ return FALSE;
+ }
+
+ g_value_unset (&value);
+
+ if (!g_value_get_string (&transformed))
+ {
+ g_value_unset (&transformed);
+ gtk_tree_path_free (path);
+
return FALSE;
}
- gtk_tooltip_set_markup (tooltip, str);
+ gtk_tooltip_set_markup (tooltip, g_value_get_string (&transformed));
gtk_tree_view_set_tooltip_row (tree_view, tooltip, path);
gtk_tree_path_free (path);
- g_free (str);
+ g_value_unset (&transformed);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]