gnucash master: Fix GtkCellRenderer* leak in price import

Christopher Lam clam at code.gnucash.org
Tue Mar 14 08:44:33 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/52a713e0 (commit)
	from  https://github.com/Gnucash/gnucash/commit/f9ebbf60 (commit)



commit 52a713e0093d072d18760a40e9ed00f4d2757991
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Mar 14 20:43:08 2023 +0800

    Fix GtkCellRenderer* leak in price import

diff --git a/gnucash/import-export/csv-imp/assistant-csv-price-import.cpp b/gnucash/import-export/csv-imp/assistant-csv-price-import.cpp
index 0fa350916f..5f7333d806 100644
--- a/gnucash/import-export/csv-imp/assistant-csv-price-import.cpp
+++ b/gnucash/import-export/csv-imp/assistant-csv-price-import.cpp
@@ -1668,10 +1668,9 @@ void CsvImpPriceAssist::preview_refresh_table ()
     /* Insert columns if the model has more data columns than the treeview. */
     while (ntcols < ncols - PREV_N_FIXED_COLS + 1)
     {
-        /* Default cell renderer is text, except for the first (error) column */
-        auto renderer = gtk_cell_renderer_text_new();
-        if (ntcols == 0)
-            renderer = gtk_cell_renderer_pixbuf_new(); // Error column uses an icon
+        /* Default cell renderer is text, except for the first (error)
+           column uses an icon */
+        auto renderer = (ntcols == 0) ? gtk_cell_renderer_pixbuf_new () : gtk_cell_renderer_text_new ();
         auto col = gtk_tree_view_column_new ();
         gtk_tree_view_column_pack_start (col, renderer, false);
         ntcols = gtk_tree_view_append_column (treeview, col);



Summary of changes:
 gnucash/import-export/csv-imp/assistant-csv-price-import.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)



More information about the gnucash-changes mailing list