gnucash master: [dialog-file-access] g_free a char* in FileAccessWindow struct

Christopher Lam clam at code.gnucash.org
Wed Mar 15 09:26:23 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/267aa4bf (commit)
	from  https://github.com/Gnucash/gnucash/commit/1f0a69a8 (commit)



commit 267aa4bf4216ea43f0eeb6cb888e602bc92313aa
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Mar 15 21:22:33 2023 +0800

    [dialog-file-access] g_free a char* in FileAccessWindow struct

diff --git a/gnucash/gnome-utils/dialog-file-access.c b/gnucash/gnome-utils/dialog-file-access.c
index 7d8c85b7d9..01ba3bdec8 100644
--- a/gnucash/gnome-utils/dialog-file-access.c
+++ b/gnucash/gnome-utils/dialog-file-access.c
@@ -243,6 +243,12 @@ get_default_database( void )
     return default_db;
 }
 
+static void free_file_access_window (FileAccessWindow *faw)
+{
+    g_free (faw->starting_dir);
+    g_free (faw);
+}
+
 static void
 gnc_ui_file_access (GtkWindow *parent, int type)
 {
@@ -280,7 +286,8 @@ gnc_ui_file_access (GtkWindow *parent, int type)
     gnc_builder_add_from_file (builder, "dialog-file-access.glade", "file_access_dialog" );
     faw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "file_access_dialog" ));
     gtk_window_set_transient_for (GTK_WINDOW (faw->dialog), parent);
-    g_object_set_data_full( G_OBJECT(faw->dialog), "FileAccessWindow", faw, g_free );
+    g_object_set_data_full (G_OBJECT(faw->dialog), "FileAccessWindow", faw,
+                            (GDestroyNotify)free_file_access_window);
 
     // Set the name for this dialog so it can be easily manipulated with css
     gtk_widget_set_name (GTK_WIDGET(faw->dialog), "gnc-id-file-access");



Summary of changes:
 gnucash/gnome-utils/dialog-file-access.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list