[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[datasets 14/18] gui: Fix g_object_get() memory leaks for PsppireWindow'
From: |
Ben Pfaff |
Subject: |
[datasets 14/18] gui: Fix g_object_get() memory leaks for PsppireWindow's filename. |
Date: |
Sat, 30 Apr 2011 22:36:42 -0700 |
g_object_get() makes a copy of strings that it returns, so every call
for "filename" was returning a copied string that the caller did not
free.
---
src/ui/gui/psppire-data-window.c | 4 ++--
src/ui/gui/psppire-window.c | 4 +---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c
index 51b853c..a463ee4 100644
--- a/src/ui/gui/psppire-data-window.c
+++ b/src/ui/gui/psppire-data-window.c
@@ -379,14 +379,14 @@ name_has_suffix (const gchar *name)
static void
save_file (PsppireWindow *w)
{
+ const gchar *file_name = NULL;
gchar *utf8_file_name = NULL;
- gchar *file_name = NULL;
GString *fnx;
struct string filename ;
PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (w);
gchar *syntax;
- g_object_get (w, "filename", &file_name, NULL);
+ file_name = psppire_window_get_filename (w);
fnx = g_string_new (file_name);
diff --git a/src/ui/gui/psppire-window.c b/src/ui/gui/psppire-window.c
index a3339ec..332abe3 100644
--- a/src/ui/gui/psppire-window.c
+++ b/src/ui/gui/psppire-window.c
@@ -510,9 +510,7 @@ psppire_window_query_save (PsppireWindow *se)
const gchar *
psppire_window_get_filename (PsppireWindow *w)
{
- const gchar *name = NULL;
- g_object_get (w, "filename", &name, NULL);
- return name;
+ return w->filename;
}
--
1.7.2.5
- [datasets 13/18] gui: Fix File|Open in syntax editor., (continued)
- [datasets 07/18] psppire-window: Use g_string_append_unichar() instead of global var., Ben Pfaff, 2011/05/01
- [datasets 08/18] gui: Include only <gtk/gtk.h> to use GTK+., Ben Pfaff, 2011/05/01
- [datasets 01/18] gui: Always convert file names to UTF-8 for use in syntax., Ben Pfaff, 2011/05/01
- [datasets 14/18] gui: Fix g_object_get() memory leaks for PsppireWindow's filename.,
Ben Pfaff <=
- [datasets 03/18] gui: Fix const-ness warning for measure_to_string() return type., Ben Pfaff, 2011/05/01
- [datasets 16/18] Implement DATASET commands., Ben Pfaff, 2011/05/01
- [datasets 10/18] gui: Prefer NULL to 0 for initializing pointers., Ben Pfaff, 2011/05/01
- [datasets 18/18] gui: Change View|Data and View|Variables to radio button menu items., Ben Pfaff, 2011/05/01
- [datasets 15/18] gui: New "entry-dialog" module for prompting for a text string., Ben Pfaff, 2011/05/01