plugged more memleaks

--Sven
This commit is contained in:
Sven Neumann 1999-11-06 18:19:41 +00:00
parent c05b97ec0b
commit a265c91c65
16 changed files with 85 additions and 36 deletions

View File

@ -1,3 +1,12 @@
Sat Nov 6 19:16:57 *ET 1999 Sven Neumann <sven@gimp.org>
* app/about_dialog.c
* app/gimpobject.c
* app/gimprc.c
* app/layer.c
* app/preferences_dialog.c
* libgimp/gimpfileselection.c: plugged more mem-leaks
Sat Nov 6 15:28:11 MET 1999 Sven Neumann <sven@gimp.org> Sat Nov 6 15:28:11 MET 1999 Sven Neumann <sven@gimp.org>
* app/gdisplay.h: Reverted my latest change. It disturbed image * app/gdisplay.h: Reverted my latest change. It disturbed image

View File

@ -229,11 +229,13 @@ about_dialog_create (gint timeout)
gdk_font_unref (style->font); gdk_font_unref (style->font);
style->font = gdk_font_load ("-Adobe-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*"); style->font = gdk_font_load ("-Adobe-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*");
gtk_widget_push_style (style); gtk_widget_push_style (style);
gtk_style_unref (style);
label_text = g_strdup_printf("%s%s%s", _("Version "), GIMP_VERSION, label_text = g_strdup_printf("%s%s%s", _("Version "), GIMP_VERSION,
_(" brought to you by")); _(" brought to you by"));
label = gtk_label_new (label_text); label = gtk_label_new (label_text);
g_free(label_text); label_text=NULL; g_free(label_text);
label_text=NULL;
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
gtk_widget_show (label); gtk_widget_show (label);

View File

@ -381,6 +381,7 @@ layer_copy (Layer *layer,
} }
/* copy the parasites */ /* copy the parasites */
gtk_object_unref (GTK_OBJECT (GIMP_DRAWABLE (new_layer)->parasites));
GIMP_DRAWABLE (new_layer)->parasites GIMP_DRAWABLE (new_layer)->parasites
= parasite_list_copy (GIMP_DRAWABLE (layer)->parasites); = parasite_list_copy (GIMP_DRAWABLE (layer)->parasites);

View File

@ -10,16 +10,17 @@ gimp_object_class_init (GimpObjectClass *gobjectclass)
{ {
} }
GtkType gimp_object_get_type (void) GtkType
gimp_object_get_type (void)
{ {
static GtkType type; static GtkType type = 0;
GIMP_TYPE_INIT(type, GIMP_TYPE_INIT(type,
GimpObject, GimpObject,
GimpObjectClass, GimpObjectClass,
gimp_object_init, gimp_object_init,
gimp_object_class_init, gimp_object_class_init,
GTK_TYPE_OBJECT); GTK_TYPE_OBJECT);
return type; return type;
} }

View File

@ -229,11 +229,13 @@ about_dialog_create (gint timeout)
gdk_font_unref (style->font); gdk_font_unref (style->font);
style->font = gdk_font_load ("-Adobe-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*"); style->font = gdk_font_load ("-Adobe-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*");
gtk_widget_push_style (style); gtk_widget_push_style (style);
gtk_style_unref (style);
label_text = g_strdup_printf("%s%s%s", _("Version "), GIMP_VERSION, label_text = g_strdup_printf("%s%s%s", _("Version "), GIMP_VERSION,
_(" brought to you by")); _(" brought to you by"));
label = gtk_label_new (label_text); label = gtk_label_new (label_text);
g_free(label_text); label_text=NULL; g_free(label_text);
label_text=NULL;
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
gtk_widget_show (label); gtk_widget_show (label);

View File

@ -822,9 +822,12 @@ file_prefs_filename_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gchar **val; gchar **val;
gchar *filename;
val = data; val = data;
file_prefs_strset (val, gimp_file_selection_get_filename (GIMP_FILE_SELECTION (widget))); filename = gimp_file_selection_get_filename (GIMP_FILE_SELECTION (widget));
file_prefs_strset (val, filename);
g_free (filename);
} }
static void static void
@ -832,9 +835,12 @@ file_prefs_path_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gchar **val; gchar **val;
gchar *path;
val = data; val = data;
file_prefs_strset (val, gimp_path_editor_get_path (GIMP_PATH_EDITOR (widget))); path = gimp_path_editor_get_path (GIMP_PATH_EDITOR (widget));
file_prefs_strset (val, path);
g_free (path);
} }
static void static void
@ -1140,7 +1146,6 @@ file_pref_cmd_callback (GtkWidget *widget,
old_monitor_yres = monitor_yres; old_monitor_yres = monitor_yres;
old_using_xserver_resolution = using_xserver_resolution; old_using_xserver_resolution = using_xserver_resolution;
old_num_processors = num_processors; old_num_processors = num_processors;
old_image_title_format = file_prefs_strdup (image_title_format);
old_global_paint_options = global_paint_options; old_global_paint_options = global_paint_options;
old_max_new_image_size = max_new_image_size; old_max_new_image_size = max_new_image_size;
old_thumbnail_mode = thumbnail_mode; old_thumbnail_mode = thumbnail_mode;
@ -1148,6 +1153,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_trust_dirty_flag = trust_dirty_flag; old_trust_dirty_flag = trust_dirty_flag;
old_use_help = use_help; old_use_help = use_help;
file_prefs_strset (&old_image_title_format, image_title_format);
file_prefs_strset (&old_temp_path, edit_temp_path); file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path); file_prefs_strset (&old_swap_path, edit_swap_path);
file_prefs_strset (&old_plug_in_path, edit_plug_in_path); file_prefs_strset (&old_plug_in_path, edit_plug_in_path);

View File

@ -381,6 +381,7 @@ layer_copy (Layer *layer,
} }
/* copy the parasites */ /* copy the parasites */
gtk_object_unref (GTK_OBJECT (GIMP_DRAWABLE (new_layer)->parasites));
GIMP_DRAWABLE (new_layer)->parasites GIMP_DRAWABLE (new_layer)->parasites
= parasite_list_copy (GIMP_DRAWABLE (layer)->parasites); = parasite_list_copy (GIMP_DRAWABLE (layer)->parasites);

View File

@ -10,16 +10,17 @@ gimp_object_class_init (GimpObjectClass *gobjectclass)
{ {
} }
GtkType gimp_object_get_type (void) GtkType
gimp_object_get_type (void)
{ {
static GtkType type; static GtkType type = 0;
GIMP_TYPE_INIT(type, GIMP_TYPE_INIT(type,
GimpObject, GimpObject,
GimpObjectClass, GimpObjectClass,
gimp_object_init, gimp_object_init,
gimp_object_class_init, gimp_object_class_init,
GTK_TYPE_OBJECT); GTK_TYPE_OBJECT);
return type; return type;
} }

View File

@ -485,6 +485,7 @@ save_gimprc_strings (gchar *token,
gchar *prev_line; gchar *prev_line;
gchar *error_msg; gchar *error_msg;
gboolean found = FALSE; gboolean found = FALSE;
gchar *personal_gimprc;
UnknownToken *ut; /* variables to modify unknown_tokens */ UnknownToken *ut; /* variables to modify unknown_tokens */
UnknownToken *tmp; UnknownToken *tmp;
@ -496,13 +497,16 @@ save_gimprc_strings (gchar *token,
/* get the name of the backup file, and the file pointers. 'name' /* get the name of the backup file, and the file pointers. 'name'
is reused in another context later, disregard it here */ is reused in another context later, disregard it here */
error_msg = open_backup_file (gimp_personal_rc_file ("gimprc"), personal_gimprc = gimp_personal_rc_file ("gimprc");
error_msg = open_backup_file (personal_gimprc,
gimp_system_rc_file (), gimp_system_rc_file (),
&name, &fp_new, &fp_old); &name, &fp_new, &fp_old);
g_free (personal_gimprc);
if (error_msg != NULL) if (error_msg != NULL)
{ {
g_message (error_msg); g_message (error_msg);
g_free (error_msg);
return; return;
} }
@ -621,18 +625,22 @@ save_gimprc (GList **updated_options,
char *cur_line; char *cur_line;
char *prev_line; char *prev_line;
char *str; char *str;
char *error_msg; gchar *error_msg;
gchar *personal_gimprc;
g_assert(updated_options != NULL); g_assert(updated_options != NULL);
g_assert(conflicting_options != NULL); g_assert(conflicting_options != NULL);
error_msg = open_backup_file (gimp_personal_rc_file ("gimprc"), personal_gimprc = gimp_personal_rc_file ("gimprc");
error_msg = open_backup_file (personal_gimprc,
gimp_system_rc_file (), gimp_system_rc_file (),
&name, &fp_new, &fp_old); &name, &fp_new, &fp_old);
g_free (personal_gimprc);
if (error_msg != NULL) if (error_msg != NULL)
{ {
g_message (error_msg); g_message (error_msg);
g_free (error_msg);
return; return;
} }

View File

@ -229,11 +229,13 @@ about_dialog_create (gint timeout)
gdk_font_unref (style->font); gdk_font_unref (style->font);
style->font = gdk_font_load ("-Adobe-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*"); style->font = gdk_font_load ("-Adobe-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*");
gtk_widget_push_style (style); gtk_widget_push_style (style);
gtk_style_unref (style);
label_text = g_strdup_printf("%s%s%s", _("Version "), GIMP_VERSION, label_text = g_strdup_printf("%s%s%s", _("Version "), GIMP_VERSION,
_(" brought to you by")); _(" brought to you by"));
label = gtk_label_new (label_text); label = gtk_label_new (label_text);
g_free(label_text); label_text=NULL; g_free(label_text);
label_text=NULL;
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
gtk_widget_show (label); gtk_widget_show (label);

View File

@ -822,9 +822,12 @@ file_prefs_filename_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gchar **val; gchar **val;
gchar *filename;
val = data; val = data;
file_prefs_strset (val, gimp_file_selection_get_filename (GIMP_FILE_SELECTION (widget))); filename = gimp_file_selection_get_filename (GIMP_FILE_SELECTION (widget));
file_prefs_strset (val, filename);
g_free (filename);
} }
static void static void
@ -832,9 +835,12 @@ file_prefs_path_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gchar **val; gchar **val;
gchar *path;
val = data; val = data;
file_prefs_strset (val, gimp_path_editor_get_path (GIMP_PATH_EDITOR (widget))); path = gimp_path_editor_get_path (GIMP_PATH_EDITOR (widget));
file_prefs_strset (val, path);
g_free (path);
} }
static void static void
@ -1140,7 +1146,6 @@ file_pref_cmd_callback (GtkWidget *widget,
old_monitor_yres = monitor_yres; old_monitor_yres = monitor_yres;
old_using_xserver_resolution = using_xserver_resolution; old_using_xserver_resolution = using_xserver_resolution;
old_num_processors = num_processors; old_num_processors = num_processors;
old_image_title_format = file_prefs_strdup (image_title_format);
old_global_paint_options = global_paint_options; old_global_paint_options = global_paint_options;
old_max_new_image_size = max_new_image_size; old_max_new_image_size = max_new_image_size;
old_thumbnail_mode = thumbnail_mode; old_thumbnail_mode = thumbnail_mode;
@ -1148,6 +1153,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_trust_dirty_flag = trust_dirty_flag; old_trust_dirty_flag = trust_dirty_flag;
old_use_help = use_help; old_use_help = use_help;
file_prefs_strset (&old_image_title_format, image_title_format);
file_prefs_strset (&old_temp_path, edit_temp_path); file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path); file_prefs_strset (&old_swap_path, edit_swap_path);
file_prefs_strset (&old_plug_in_path, edit_plug_in_path); file_prefs_strset (&old_plug_in_path, edit_plug_in_path);

View File

@ -381,6 +381,7 @@ layer_copy (Layer *layer,
} }
/* copy the parasites */ /* copy the parasites */
gtk_object_unref (GTK_OBJECT (GIMP_DRAWABLE (new_layer)->parasites));
GIMP_DRAWABLE (new_layer)->parasites GIMP_DRAWABLE (new_layer)->parasites
= parasite_list_copy (GIMP_DRAWABLE (layer)->parasites); = parasite_list_copy (GIMP_DRAWABLE (layer)->parasites);

View File

@ -822,9 +822,12 @@ file_prefs_filename_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gchar **val; gchar **val;
gchar *filename;
val = data; val = data;
file_prefs_strset (val, gimp_file_selection_get_filename (GIMP_FILE_SELECTION (widget))); filename = gimp_file_selection_get_filename (GIMP_FILE_SELECTION (widget));
file_prefs_strset (val, filename);
g_free (filename);
} }
static void static void
@ -832,9 +835,12 @@ file_prefs_path_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gchar **val; gchar **val;
gchar *path;
val = data; val = data;
file_prefs_strset (val, gimp_path_editor_get_path (GIMP_PATH_EDITOR (widget))); path = gimp_path_editor_get_path (GIMP_PATH_EDITOR (widget));
file_prefs_strset (val, path);
g_free (path);
} }
static void static void
@ -1140,7 +1146,6 @@ file_pref_cmd_callback (GtkWidget *widget,
old_monitor_yres = monitor_yres; old_monitor_yres = monitor_yres;
old_using_xserver_resolution = using_xserver_resolution; old_using_xserver_resolution = using_xserver_resolution;
old_num_processors = num_processors; old_num_processors = num_processors;
old_image_title_format = file_prefs_strdup (image_title_format);
old_global_paint_options = global_paint_options; old_global_paint_options = global_paint_options;
old_max_new_image_size = max_new_image_size; old_max_new_image_size = max_new_image_size;
old_thumbnail_mode = thumbnail_mode; old_thumbnail_mode = thumbnail_mode;
@ -1148,6 +1153,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_trust_dirty_flag = trust_dirty_flag; old_trust_dirty_flag = trust_dirty_flag;
old_use_help = use_help; old_use_help = use_help;
file_prefs_strset (&old_image_title_format, image_title_format);
file_prefs_strset (&old_temp_path, edit_temp_path); file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path); file_prefs_strset (&old_swap_path, edit_swap_path);
file_prefs_strset (&old_plug_in_path, edit_plug_in_path); file_prefs_strset (&old_plug_in_path, edit_plug_in_path);

View File

@ -234,7 +234,7 @@ gimp_file_selection_set_filename (GimpFileSelection *gfs,
g_return_if_fail (gfs != NULL); g_return_if_fail (gfs != NULL);
g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs)); g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs));
gtk_entry_set_text (GTK_ENTRY (gfs->entry), g_strdup (filename)); gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
/* update everything /* update everything
*/ */
@ -411,4 +411,5 @@ gimp_file_selection_check_filename (GimpFileSelection *gfs)
gtk_pixmap_set (GTK_PIXMAP (gfs->file_exists), gtk_pixmap_set (GTK_PIXMAP (gfs->file_exists),
gfs->no_pixmap, gfs->no_mask); gfs->no_pixmap, gfs->no_mask);
} }
g_free (filename);
} }

View File

@ -234,7 +234,7 @@ gimp_file_selection_set_filename (GimpFileSelection *gfs,
g_return_if_fail (gfs != NULL); g_return_if_fail (gfs != NULL);
g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs)); g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs));
gtk_entry_set_text (GTK_ENTRY (gfs->entry), g_strdup (filename)); gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
/* update everything /* update everything
*/ */
@ -411,4 +411,5 @@ gimp_file_selection_check_filename (GimpFileSelection *gfs)
gtk_pixmap_set (GTK_PIXMAP (gfs->file_exists), gtk_pixmap_set (GTK_PIXMAP (gfs->file_exists),
gfs->no_pixmap, gfs->no_mask); gfs->no_pixmap, gfs->no_mask);
} }
g_free (filename);
} }

View File

@ -234,7 +234,7 @@ gimp_file_selection_set_filename (GimpFileSelection *gfs,
g_return_if_fail (gfs != NULL); g_return_if_fail (gfs != NULL);
g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs)); g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs));
gtk_entry_set_text (GTK_ENTRY (gfs->entry), g_strdup (filename)); gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
/* update everything /* update everything
*/ */
@ -411,4 +411,5 @@ gimp_file_selection_check_filename (GimpFileSelection *gfs)
gtk_pixmap_set (GTK_PIXMAP (gfs->file_exists), gtk_pixmap_set (GTK_PIXMAP (gfs->file_exists),
gfs->no_pixmap, gfs->no_mask); gfs->no_pixmap, gfs->no_mask);
} }
g_free (filename);
} }