Commit f1405056 authored by Kristian Rietveld's avatar Kristian Rietveld Committed by Kristian Rietveld

Bug 530146 - Setting non-string tooltip with

2008-05-31  Kristian Rietveld  <kris@imendio.com>

	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.


svn path=/trunk/; revision=20261
parent 2ab7f3dd
2008-05-31 Kristian Rietveld <kris@imendio.com>
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.
2008-05-30 Tor Lillqvist <tml@novell.com>
* modules/engines/ms-windows/msw_style.h
......
......@@ -15514,7 +15514,8 @@ gtk_tree_view_set_tooltip_query_cb (GtkWidget *widget,
GtkTooltip *tooltip,
gpointer data)
{
gchar *str;
GValue value = { 0, };
GValue transformed = { 0, };
GtkTreeIter iter;
GtkTreePath *path;
GtkTreeModel *model;
......@@ -15526,19 +15527,34 @@ gtk_tree_view_set_tooltip_query_cb (GtkWidget *widget,
&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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment