free GtkTreePath after calling gtk_tree_view_get_path_at_pos

This commit is contained in:
Christopher Lam 2021-08-28 22:05:37 +08:00
parent 8a48ed9777
commit e13644dffc
3 changed files with 21 additions and 0 deletions

View File

@ -423,6 +423,7 @@ custom_report_list_view_clicked_cb(GtkTreeView *view, GdkEventButton *event, gpo
{ {
SCM guid = get_custom_report_selection(crd, _("You must select a report configuration to load.")); SCM guid = get_custom_report_selection(crd, _("You must select a report configuration to load."));
custom_report_run_report (guid, crd); custom_report_run_report (guid, crd);
gtk_tree_path_free (path);
return TRUE; return TRUE;
} }
else if (column == crd->editcol) else if (column == crd->editcol)
@ -430,14 +431,17 @@ custom_report_list_view_clicked_cb(GtkTreeView *view, GdkEventButton *event, gpo
g_object_set(G_OBJECT(crd->namerenderer), "editable", TRUE, NULL); g_object_set(G_OBJECT(crd->namerenderer), "editable", TRUE, NULL);
gtk_tree_view_set_cursor_on_cell (view, path, crd->namecol, gtk_tree_view_set_cursor_on_cell (view, path, crd->namecol,
crd->namerenderer, TRUE); crd->namerenderer, TRUE);
gtk_tree_path_free (path);
return TRUE; return TRUE;
} }
else if (column == crd->delcol) else if (column == crd->delcol)
{ {
SCM guid = get_custom_report_selection(crd, _("You must select a report configuration to delete.")); SCM guid = get_custom_report_selection(crd, _("You must select a report configuration to delete."));
custom_report_delete (guid, crd); custom_report_delete (guid, crd);
gtk_tree_path_free (path);
return TRUE; return TRUE;
} }
gtk_tree_path_free (path);
} }
return FALSE; return FALSE;
} }
@ -489,10 +493,12 @@ custom_report_query_tooltip_cb (GtkTreeView *view,
gtk_tooltip_set_text (tooltip, _("Edit report configuration name")); gtk_tooltip_set_text (tooltip, _("Edit report configuration name"));
else if (column == crd->delcol) else if (column == crd->delcol)
gtk_tooltip_set_text (tooltip, _("Delete report configuration")); gtk_tooltip_set_text (tooltip, _("Delete report configuration"));
gtk_tree_path_free (path);
return TRUE; return TRUE;
} }
else else
gtk_tooltip_set_text (tooltip, NULL); gtk_tooltip_set_text (tooltip, NULL);
gtk_tree_path_free (path);
} }
return FALSE; return FALSE;
} }

View File

@ -945,19 +945,31 @@ query_tooltip_tree_view_cb (GtkWidget *widget, gint x, gint y,
if (keyboard_tip || !gtk_tree_view_get_path_at_pos (tree_view, x, y, &path, if (keyboard_tip || !gtk_tree_view_get_path_at_pos (tree_view, x, y, &path,
&column, NULL, NULL)) &column, NULL, NULL))
{
gtk_tree_path_free (path);
return FALSE; return FALSE;
}
if (!column) if (!column)
{
gtk_tree_path_free (path);
return FALSE; return FALSE;
}
period_num = GPOINTER_TO_UINT(g_object_get_data (G_OBJECT(column), "period_num")); period_num = GPOINTER_TO_UINT(g_object_get_data (G_OBJECT(column), "period_num"));
if (!period_num && priv->period_col_list->data != column) if (!period_num && priv->period_col_list->data != column)
{
gtk_tree_path_free (path);
return FALSE; return FALSE;
}
account = gnc_tree_view_account_get_account_from_path ( account = gnc_tree_view_account_get_account_from_path (
GNC_TREE_VIEW_ACCOUNT(widget), path); GNC_TREE_VIEW_ACCOUNT(widget), path);
note = gnc_budget_get_account_period_note (priv->budget, account, period_num); note = gnc_budget_get_account_period_note (priv->budget, account, period_num);
if (!note) if (!note)
{
gtk_tree_path_free (path);
return FALSE; return FALSE;
}
gtk_tooltip_set_text (tooltip, note); gtk_tooltip_set_text (tooltip, note);
gtk_tree_view_set_tooltip_cell (tree_view, tooltip, path, column, NULL); gtk_tree_view_set_tooltip_cell (tree_view, tooltip, path, column, NULL);

View File

@ -1898,7 +1898,10 @@ query_tooltip_tree_view_cb (GtkWidget *widget, gint x, gint y,
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y, &x, &y); gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y, &x, &y);
if (keyboard_tip || !gtk_tree_view_get_path_at_pos (tree_view, x, y, &path, if (keyboard_tip || !gtk_tree_view_get_path_at_pos (tree_view, x, y, &path,
&column, NULL, NULL)) &column, NULL, NULL))
{
gtk_tree_path_free (path);
return FALSE; return FALSE;
}
// Get the iter pointing to our current column // Get the iter pointing to our current column
if (gtk_tree_model_get_iter(model, &iter, path) && column) if (gtk_tree_model_get_iter(model, &iter, path) && column)