[gthumb] fixed a good amount of memory leaks
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] fixed a good amount of memory leaks
- Date: Sat, 24 Mar 2012 16:18:33 +0000 (UTC)
commit 72c3f05d0a9809231bfeda6f8c61d7829d295c97
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Mar 24 17:09:41 2012 +0100
fixed a good amount of memory leaks
extensions/bookmarks/callbacks.c | 6 ++++--
extensions/cairo_io/cairo-io-png.c | 1 +
extensions/catalogs/gth-catalog.c | 12 ++++++++++--
extensions/catalogs/gth-file-source-catalogs.c | 13 +++++++++----
extensions/comments/gth-comment.c | 1 +
extensions/exiv2_tools/exiv2-utils.cpp | 7 +++++--
extensions/file_manager/callbacks.c | 2 +-
extensions/selections/gth-selections-manager.c | 14 +++++++++++---
gthumb/gio-utils.c | 3 ++-
gthumb/glib-utils.c | 10 +++++++---
gthumb/gnome-desktop-thumbnail.c | 2 +-
gthumb/gth-browser.c | 6 +++++-
gthumb/gth-extensions.c | 6 +++++-
gthumb/gth-file-data.c | 2 ++
gthumb/gth-file-list.c | 1 +
gthumb/gth-file-store.c | 9 +++++----
gthumb/gth-filter-file.c | 2 ++
gthumb/gth-filter.c | 2 ++
gthumb/gth-image-loader.c | 15 ++++++++-------
gthumb/gth-image-viewer.c | 1 +
gthumb/gth-image.c | 5 +++--
gthumb/gth-location-chooser.c | 2 ++
gthumb/gth-main.c | 13 +++++++------
gthumb/gth-multipage.c | 18 ++++++++++++++++++
gthumb/gth-tags-file.c | 2 ++
gthumb/gth-test-chain.c | 1 +
gthumb/gth-test.c | 1 +
gthumb/gth-thumb-loader.c | 4 ++++
gthumb/gth-time-selector.c | 2 ++
gthumb/gtk-utils.c | 2 +-
30 files changed, 124 insertions(+), 41 deletions(-)
---
diff --git a/extensions/bookmarks/callbacks.c b/extensions/bookmarks/callbacks.c
index 3ff698e..a5e07ff 100644
--- a/extensions/bookmarks/callbacks.c
+++ b/extensions/bookmarks/callbacks.c
@@ -138,8 +138,10 @@ update_system_bookmark_list_from_content (GthBrowser *browser,
line = g_strsplit (lines[i], " ", 2);
uri = line[0];
- if (uri == NULL)
+ if (uri == NULL) {
+ g_strfreev (line);
continue;
+ }
file = g_file_new_for_uri (uri);
icon = _g_file_get_icon (file);
@@ -159,7 +161,7 @@ update_system_bookmark_list_from_content (GthBrowser *browser,
-1);
g_free (name);
- g_object_unref (icon);
+ _g_object_unref (icon);
g_object_unref (file);
g_strfreev (line);
}
diff --git a/extensions/cairo_io/cairo-io-png.c b/extensions/cairo_io/cairo-io-png.c
index 5a86537..2c27da5 100644
--- a/extensions/cairo_io/cairo-io-png.c
+++ b/extensions/cairo_io/cairo-io-png.c
@@ -245,6 +245,7 @@ _cairo_image_surface_create_from_png (GthFileData *file_data,
if (cairo_surface_status (cairo_png_data->surface) == CAIRO_STATUS_SUCCESS)
gth_image_set_cairo_surface (image, cairo_png_data->surface);
+ g_free (row_pointers);
_cairo_png_data_destroy (cairo_png_data);
return image;
diff --git a/extensions/catalogs/gth-catalog.c b/extensions/catalogs/gth-catalog.c
index 19dc87f..42e28b4 100644
--- a/extensions/catalogs/gth-catalog.c
+++ b/extensions/catalogs/gth-catalog.c
@@ -642,6 +642,8 @@ get_display_name (GFile *file,
}
}
+ g_free (basename);
+
return g_string_free (display_name, FALSE);
}
@@ -675,6 +677,8 @@ get_edit_name (GFile *file,
g_string_append (display_name, name);
}
+ g_free (basename);
+
return g_string_free (display_name, FALSE);
}
@@ -695,6 +699,8 @@ update_standard_attributes (GFile *file,
sort_order_s = gth_datetime_strftime (date_time, "%Y%m%d");
sort_order = atoi (sort_order_s);
g_file_info_set_sort_order (info, sort_order);
+
+ g_free (sort_order_s);
}
else if (g_file_info_get_attribute_boolean (info, "gthumb::no-child"))
g_file_info_set_sort_order (info, 99999999);
@@ -822,6 +828,7 @@ gth_catalog_file_to_gio_file (GFile *file)
full_uri = g_strconcat (base_uri, part ? "/" : NULL, part, NULL);
gio_file = g_file_new_for_uri (full_uri);
+ g_free (full_uri);
g_free (base_uri);
g_object_unref (base);
}
@@ -1158,7 +1165,8 @@ gth_catalog_save (GthCatalog *catalog)
gio_file = gth_catalog_file_to_gio_file (file);
gio_parent = g_file_get_parent (gio_file);
- g_file_make_directory_with_parents (gio_parent, NULL, NULL);
+ if (gio_parent != NULL)
+ g_file_make_directory_with_parents (gio_parent, NULL, NULL);
data = gth_catalog_to_data (catalog, &size);
if (! g_write_file (gio_file,
FALSE,
@@ -1198,6 +1206,6 @@ gth_catalog_save (GthCatalog *catalog)
}
g_free (data);
- g_object_unref (gio_parent);
+ _g_object_unref (gio_parent);
g_object_unref (gio_file);
}
diff --git a/extensions/catalogs/gth-file-source-catalogs.c b/extensions/catalogs/gth-file-source-catalogs.c
index c118b06..82e3a3e 100644
--- a/extensions/catalogs/gth-file-source-catalogs.c
+++ b/extensions/catalogs/gth-file-source-catalogs.c
@@ -71,14 +71,16 @@ update_file_info (GthFileSource *file_source,
GFile *catalog_file,
GFileInfo *info)
{
- char *uri;
+ char *uri;
+ GIcon *icon = NULL;
uri = g_file_get_uri (catalog_file);
if (g_str_has_suffix (uri, ".gqv") || g_str_has_suffix (uri, ".catalog")) {
g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY);
g_file_info_set_content_type (info, "gthumb/catalog");
- g_file_info_set_icon (info, g_themed_icon_new ("file-catalog"));
+ icon = g_themed_icon_new ("file-catalog");
+ g_file_info_set_icon (info, icon);
g_file_info_set_sort_order (info, 1);
g_file_info_set_attribute_boolean (info, "gthumb::no-child", TRUE);
gth_catalog_update_standard_attributes (catalog_file, info);
@@ -86,7 +88,8 @@ update_file_info (GthFileSource *file_source,
else if (g_str_has_suffix (uri, ".search")) {
g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY);
g_file_info_set_content_type (info, "gthumb/search");
- g_file_info_set_icon (info, g_themed_icon_new ("file-search"));
+ icon = g_themed_icon_new ("file-search");
+ g_file_info_set_icon (info, icon);
g_file_info_set_sort_order (info, 1);
g_file_info_set_attribute_boolean (info, "gthumb::no-child", TRUE);
gth_catalog_update_standard_attributes (catalog_file, info);
@@ -94,12 +97,14 @@ update_file_info (GthFileSource *file_source,
else {
g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY);
g_file_info_set_content_type (info, "gthumb/library");
- g_file_info_set_icon (info, g_themed_icon_new ("file-library"));
+ icon = g_themed_icon_new ("file-library");
+ g_file_info_set_icon (info, icon);
g_file_info_set_sort_order (info, 0);
g_file_info_set_attribute_boolean (info, "gthumb::no-child", FALSE);
gth_catalog_update_standard_attributes (catalog_file, info);
}
+ _g_object_unref (icon);
g_free (uri);
}
diff --git a/extensions/comments/gth-comment.c b/extensions/comments/gth-comment.c
index 504c156..a2b1f2c 100644
--- a/extensions/comments/gth-comment.c
+++ b/extensions/comments/gth-comment.c
@@ -317,6 +317,7 @@ gth_comment_new_for_file (GFile *file,
comment = NULL;
}
+ g_object_unref (doc);
g_free (buffer);
g_free (zipped_buffer);
diff --git a/extensions/exiv2_tools/exiv2-utils.cpp b/extensions/exiv2_tools/exiv2-utils.cpp
index b57d618..0a65c7d 100644
--- a/extensions/exiv2_tools/exiv2-utils.cpp
+++ b/extensions/exiv2_tools/exiv2-utils.cpp
@@ -392,7 +392,6 @@ set_attribute_from_metadata (GFileInfo *info,
const char *attribute,
GObject *metadata)
{
- char *key;
char *description;
char *formatted_value;
char *raw_value;
@@ -402,7 +401,6 @@ set_attribute_from_metadata (GFileInfo *info,
return;
g_object_get (metadata,
- "id", &key,
"description", &description,
"formatted", &formatted_value,
"raw", &raw_value,
@@ -416,6 +414,11 @@ set_attribute_from_metadata (GFileInfo *info,
raw_value,
NULL,
type_name);
+
+ g_free (description);
+ g_free (formatted_value);
+ g_free (raw_value);
+ g_free (type_name);
}
diff --git a/extensions/file_manager/callbacks.c b/extensions/file_manager/callbacks.c
index 4de61d6..711c4a2 100644
--- a/extensions/file_manager/callbacks.c
+++ b/extensions/file_manager/callbacks.c
@@ -1105,7 +1105,7 @@ _gth_browser_update_open_menu (GthBrowser *browser,
gtk_widget_show (openwith_item);
g_hash_table_destroy (used_apps);
- g_list_free (appinfo_list);
+ _g_object_list_unref (appinfo_list);
_g_object_list_unref (file_list);
_gtk_tree_path_list_free (items);
}
diff --git a/extensions/selections/gth-selections-manager.c b/extensions/selections/gth-selections-manager.c
index 8b6283a..03de1ac 100644
--- a/extensions/selections/gth-selections-manager.c
+++ b/extensions/selections/gth-selections-manager.c
@@ -228,12 +228,20 @@ gth_selections_manager_update_file_info (GFile *file,
/* icon */
if (n_selection > 0) {
+ GIcon *icon;
+
name = g_strdup_printf ("selection%d", n_selection);
- g_file_info_set_icon (info, g_themed_icon_new (name));
+ icon = g_themed_icon_new (name);
+ g_file_info_set_icon (info, icon);
+
+ g_object_unref (icon);
g_free (name);
}
- else
- g_file_info_set_icon (info, g_themed_icon_new ("selection"));
+ else {
+ GIcon *icon = g_themed_icon_new ("selection");
+ g_file_info_set_icon (info, icon);
+ g_object_unref (icon);
+ }
/* display name */
diff --git a/gthumb/gio-utils.c b/gthumb/gio-utils.c
index 14bdb30..68f8ba3 100644
--- a/gthumb/gio-utils.c
+++ b/gthumb/gio-utils.c
@@ -201,9 +201,10 @@ for_each_child_data_free (ForEachChildData *fec)
return;
g_object_unref (fec->base_directory);
- if (fec->already_visited)
+ if (fec->already_visited != NULL)
g_hash_table_destroy (fec->already_visited);
clear_child_data (&(fec->current));
+ g_free (fec->attributes);
if (fec->to_visit != NULL) {
g_list_foreach (fec->to_visit, (GFunc) child_data_free, NULL);
g_list_free (fec->to_visit);
diff --git a/gthumb/glib-utils.c b/gthumb/glib-utils.c
index 4100212..2a1b6ce 100644
--- a/gthumb/glib-utils.c
+++ b/gthumb/glib-utils.c
@@ -1923,8 +1923,10 @@ _g_file_get_display_name (GFile *file)
G_FILE_QUERY_INFO_NONE,
NULL,
NULL);
- if (file_info != NULL)
+ if (file_info != NULL) {
name = g_strdup (g_file_info_get_attribute_string (file_info, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME));
+ g_object_unref (file_info);
+ }
else
name = g_file_get_parse_name (file);
@@ -2073,8 +2075,10 @@ _g_file_get_icon (GFile *file)
G_FILE_QUERY_INFO_NONE,
NULL,
NULL);
- if (file_info != NULL)
- icon = (GIcon*) g_file_info_get_attribute_object (file_info, G_FILE_ATTRIBUTE_STANDARD_ICON);
+ if (file_info != NULL) {
+ icon = (GIcon*) g_object_ref (g_file_info_get_attribute_object (file_info, G_FILE_ATTRIBUTE_STANDARD_ICON));
+ g_object_unref (file_info);
+ }
if (icon == NULL)
icon = g_themed_icon_new ("file");
diff --git a/gthumb/gnome-desktop-thumbnail.c b/gthumb/gnome-desktop-thumbnail.c
index 0e08e80..601c6f5 100644
--- a/gthumb/gnome-desktop-thumbnail.c
+++ b/gthumb/gnome-desktop-thumbnail.c
@@ -1573,7 +1573,7 @@ read_png_options (const char *thumbnail_filename)
f = fopen (thumbnail_filename, "r");
if (f == NULL) {
- png_destroy_read_struct (&png_ptr, NULL, NULL);
+ png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return options;
}
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index ab71969..53d9a0b 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -3330,6 +3330,7 @@ pref_general_filter_changed (GSettings *settings,
filter = _gth_browser_get_file_filter (browser);
gth_file_list_set_filter (GTH_FILE_LIST (browser->priv->file_list), filter);
gth_file_list_set_filter (GTH_FILE_LIST (browser->priv->thumbnail_list), filter);
+
g_object_unref (filter);
}
@@ -4033,6 +4034,7 @@ gth_browser_init (GthBrowser *browser)
GtkWidget *menubar;
GtkOrientation viewer_thumbnails_orientation;
char *general_filter;
+ char *sort_type;
char *caption;
int i;
@@ -4410,8 +4412,9 @@ gth_browser_init (GthBrowser *browser)
/* the file list */
browser->priv->file_list = gth_file_list_new (gth_grid_view_new (), GTH_FILE_LIST_TYPE_NORMAL, TRUE);
+ sort_type = g_settings_get_string (browser->priv->browser_settings, PREF_BROWSER_SORT_TYPE);
gth_browser_set_sort_order (browser,
- gth_main_get_sort_type (g_settings_get_string (browser->priv->browser_settings, PREF_BROWSER_SORT_TYPE)),
+ gth_main_get_sort_type (sort_type),
g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_SORT_INVERSE));
gth_browser_enable_thumbnails (browser, g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_SHOW_THUMBNAILS));
gth_file_list_set_thumb_size (GTH_FILE_LIST (browser->priv->file_list),
@@ -4420,6 +4423,7 @@ gth_browser_init (GthBrowser *browser)
gth_file_list_set_caption (GTH_FILE_LIST (browser->priv->file_list), caption);
g_free (caption);
+ g_free (sort_type);
gtk_widget_show (browser->priv->file_list);
gtk_box_pack_start (GTK_BOX (vbox), browser->priv->file_list, TRUE, TRUE, 0);
diff --git a/gthumb/gth-extensions.c b/gthumb/gth-extensions.c
index 9f378a3..f0d1c75 100644
--- a/gthumb/gth-extensions.c
+++ b/gthumb/gth-extensions.c
@@ -452,8 +452,11 @@ gth_extension_description_load_from_file (GthExtensionDescription *desc,
key_file = g_key_file_new ();
file_path = g_file_get_path (file);
- if (! g_key_file_load_from_file (key_file, file_path, G_KEY_FILE_NONE, NULL))
+ if (! g_key_file_load_from_file (key_file, file_path, G_KEY_FILE_NONE, NULL)) {
+ g_free (file_path);
+ g_key_file_free (key_file);
return FALSE;
+ }
basename = g_file_get_basename (file);
desc->id = _g_uri_remove_extension (basename);
@@ -849,6 +852,7 @@ gth_extension_manager_order_extensions (GthExtensionManager *manager,
ordered_by_dependency = _g_list_prepend_link (ordered_by_dependency, link);
}
}
+ g_list_free (dependencies);
/* prepend the extension to the ordered list */
extension_list = g_list_remove_link (extension_list, scan);
diff --git a/gthumb/gth-file-data.c b/gthumb/gth-file-data.c
index c79223c..9c424ff 100644
--- a/gthumb/gth-file-data.c
+++ b/gthumb/gth-file-data.c
@@ -548,6 +548,8 @@ gth_file_data_list_get_common_info (GList *file_data_list,
if (first_value == NULL)
g_file_info_remove_attribute (info, attribute);
+
+ g_free (first_value);
}
g_strfreev (attributes_v);
diff --git a/gthumb/gth-file-list.c b/gthumb/gth-file-list.c
index 96355b5..7d35013 100644
--- a/gthumb/gth-file-list.c
+++ b/gthumb/gth-file-list.c
@@ -1436,6 +1436,7 @@ thumbnail_job_ready_cb (GObject *source_object,
if ((! success && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|| file_list->priv->cancelling)
{
+ _g_object_unref (pixbuf);
thumbnail_job_free (job);
return;
}
diff --git a/gthumb/gth-file-store.c b/gthumb/gth-file-store.c
index 461818c..41216b5 100644
--- a/gthumb/gth-file-store.c
+++ b/gthumb/gth-file-store.c
@@ -144,11 +144,11 @@ _gth_file_row_copy (GthFileRow *row)
}
-G_GNUC_UNUSED
-static void
+static GthFileRow *
_gth_file_row_ref (GthFileRow *row)
{
row->ref_count++;
+ return row;
}
@@ -169,6 +169,7 @@ _gth_file_row_unref (GthFileRow *row)
static void
_gth_file_store_clear_queue (GthFileStore *file_store)
{
+ g_list_foreach (file_store->priv->queue, (GFunc) _gth_file_row_unref, NULL);
g_list_free (file_store->priv->queue);
file_store->priv->queue = NULL;
}
@@ -803,7 +804,7 @@ g_print ("UPDATE VISIBILITY\n");
for (i = 0; i < position; i++)
all_rows[j++] = _gth_file_row_copy (file_store->priv->all_rows[i]);
for (scan = add_queue; scan; scan = scan->next)
- all_rows[j++] = (GthFileRow *) scan->data;
+ all_rows[j++] = _gth_file_row_ref ((GthFileRow *) scan->data);
for (i = position; i < file_store->priv->tot_rows; i++)
all_rows[j++] = _gth_file_row_copy (file_store->priv->all_rows[i]);
@@ -1565,7 +1566,7 @@ gth_file_store_queue_remove (GthFileStore *file_store,
row = (GthFileRow*) iter->user_data;
- file_store->priv->queue = g_list_prepend (file_store->priv->queue, file_store->priv->all_rows[row->abs_pos]);
+ file_store->priv->queue = g_list_prepend (file_store->priv->queue, _gth_file_row_ref (file_store->priv->all_rows[row->abs_pos]));
}
diff --git a/gthumb/gth-filter-file.c b/gthumb/gth-filter-file.c
index d5e006b..2f74639 100644
--- a/gthumb/gth-filter-file.c
+++ b/gthumb/gth-filter-file.c
@@ -53,6 +53,8 @@ gth_filter_file_new (void)
void
gth_filter_file_free (GthFilterFile *filters)
{
+ if (filters == NULL)
+ return;
_g_object_list_unref (filters->items);
g_free (filters);
}
diff --git a/gthumb/gth-filter.c b/gthumb/gth-filter.c
index 479759d..31bfb51 100644
--- a/gthumb/gth-filter.c
+++ b/gthumb/gth-filter.c
@@ -137,6 +137,8 @@ gth_filter_real_load_from_element (DomDomizable *base,
test = gth_test_chain_new (GTH_MATCH_TYPE_NONE, NULL);
dom_domizable_load_from_element (DOM_DOMIZABLE (test), node);
gth_filter_set_test (self, GTH_TEST_CHAIN (test));
+
+ g_object_unref (test);
}
else if (g_strcmp0 (node->tag_name, "limit") == 0) {
gth_filter_set_limit (self,
diff --git a/gthumb/gth-image-loader.c b/gthumb/gth-image-loader.c
index e3c7720..a0f8b51 100644
--- a/gthumb/gth-image-loader.c
+++ b/gthumb/gth-image-loader.c
@@ -204,17 +204,18 @@ load_pixbuf_thread (GSimpleAsyncResult *result,
error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("No suitable loader available for this file type"));
}
- load_result = g_new0 (LoadResult, 1);
- load_result->image = image;
- load_result->original_width = original_width;
- load_result->original_height = original_height;
-
if (error != NULL) {
+ _g_object_unref (image);
g_simple_async_result_set_from_error (result, error);
g_error_free (error);
+ return;
}
- else
- g_simple_async_result_set_op_res_gpointer (result, load_result, (GDestroyNotify) load_result_unref);
+
+ load_result = g_new0 (LoadResult, 1);
+ load_result->image = image;
+ load_result->original_width = original_width;
+ load_result->original_height = original_height;
+ g_simple_async_result_set_op_res_gpointer (result, load_result, (GDestroyNotify) load_result_unref);
}
diff --git a/gthumb/gth-image-viewer.c b/gthumb/gth-image-viewer.c
index f29b448..0916658 100644
--- a/gthumb/gth-image-viewer.c
+++ b/gthumb/gth-image-viewer.c
@@ -169,6 +169,7 @@ gth_image_viewer_finalize (GObject *object)
}
g_list_foreach (self->priv->painters, (GFunc) painter_data_free, NULL);
+ _g_object_unref (self->priv->tool);
_g_clear_object (&self->priv->image);
_g_clear_object (&self->priv->animation);
diff --git a/gthumb/gth-image.c b/gthumb/gth-image.c
index d999039..9c27a52 100644
--- a/gthumb/gth-image.c
+++ b/gthumb/gth-image.c
@@ -231,7 +231,7 @@ gth_image_get_pixbuf (GthImage *image)
break;
case GTH_IMAGE_FORMAT_GDK_PIXBUF:
- result = g_object_ref (image->priv->data.pixbuf);
+ result = _g_object_ref (image->priv->data.pixbuf);
break;
case GTH_IMAGE_FORMAT_GDK_PIXBUF_ANIMATION:
@@ -283,7 +283,8 @@ gth_image_get_pixbuf_animation (GthImage *image)
break;
case GTH_IMAGE_FORMAT_GDK_PIXBUF:
- result = gdk_pixbuf_non_anim_new (image->priv->data.pixbuf);
+ if (image->priv->data.pixbuf != NULL)
+ result = gdk_pixbuf_non_anim_new (image->priv->data.pixbuf);
break;
case GTH_IMAGE_FORMAT_GDK_PIXBUF_ANIMATION:
diff --git a/gthumb/gth-location-chooser.c b/gthumb/gth-location-chooser.c
index 956d122..f424e15 100644
--- a/gthumb/gth-location-chooser.c
+++ b/gthumb/gth-location-chooser.c
@@ -471,6 +471,8 @@ update_location_list (gpointer user_data)
g_object_unref (info);
}
+
+ _g_object_list_unref (list);
}
}
diff --git a/gthumb/gth-main.c b/gthumb/gth-main.c
index 6ed5b36..691131e 100644
--- a/gthumb/gth-main.c
+++ b/gthumb/gth-main.c
@@ -143,10 +143,11 @@ gth_main_finalize (GObject *object)
if (gth_main->priv->bookmarks != NULL)
g_bookmark_file_free (gth_main->priv->bookmarks);
- if (gth_main->priv->monitor != NULL)
- g_object_unref (gth_main->priv->monitor);
- if (gth_main->priv->extension_manager != NULL)
- g_object_unref (gth_main->priv->extension_manager);
+
+ _g_object_unref (gth_main->priv->monitor);
+ _g_object_unref (gth_main->priv->extension_manager);
+ gth_filter_file_free (gth_main->priv->filters);
+ gth_tags_file_free (gth_main->priv->tags);
g_free (gth_main->priv);
gth_main->priv = NULL;
@@ -777,7 +778,6 @@ gth_main_add_general_filter (GthTest *original_filter)
new_chain = gth_test_chain_new (GTH_MATCH_TYPE_ALL, NULL);
gth_test_chain_add_test (GTH_TEST_CHAIN (new_chain), test);
- g_object_unref (test);
if (strncmp (gth_test_get_id (test), "file::type::", 12) != 0) {
GthTest *file_type_filter;
@@ -789,6 +789,7 @@ gth_main_add_general_filter (GthTest *original_filter)
gth_filter_set_test (filter, GTH_TEST_CHAIN (new_chain));
g_object_unref (new_chain);
+ g_object_unref (test);
test = (GthTest*) filter;
}
else {
@@ -1319,7 +1320,7 @@ attribute_list_reload_required (const char *old_attributes,
}
}
- g_object_ref (provider);
+ g_object_unref (provider);
}
/*
diff --git a/gthumb/gth-multipage.c b/gthumb/gth-multipage.c
index 8714887..7d13c0c 100644
--- a/gthumb/gth-multipage.c
+++ b/gthumb/gth-multipage.c
@@ -55,10 +55,28 @@ G_DEFINE_TYPE (GthMultipage, gth_multipage, GTK_TYPE_BOX)
static void
+gth_multipage_finalize (GObject *object)
+{
+ GthMultipage *multipage;
+
+ multipage = GTH_MULTIPAGE (object);
+
+ g_list_free (multipage->priv->children);
+
+ G_OBJECT_CLASS (gth_multipage_parent_class)->finalize (object);
+}
+
+
+static void
gth_multipage_class_init (GthMultipageClass *klass)
{
+ GObjectClass *object_class;
+
g_type_class_add_private (klass, sizeof (GthMultipagePrivate));
+ object_class = (GObjectClass*) klass;
+ object_class->finalize = gth_multipage_finalize;
+
/* signals */
gth_multipage_signals[CHANGED] =
diff --git a/gthumb/gth-tags-file.c b/gthumb/gth-tags-file.c
index b45601a..7e8c44e 100644
--- a/gthumb/gth-tags-file.c
+++ b/gthumb/gth-tags-file.c
@@ -53,6 +53,8 @@ gth_tags_file_new (void)
void
gth_tags_file_free (GthTagsFile *tags)
{
+ if (tags == NULL)
+ return;
_g_string_list_free (tags->items);
g_strfreev (tags->tags);
g_free (tags);
diff --git a/gthumb/gth-test-chain.c b/gthumb/gth-test-chain.c
index c61121b..b97c34a 100644
--- a/gthumb/gth-test-chain.c
+++ b/gthumb/gth-test-chain.c
@@ -64,6 +64,7 @@ gth_test_chain_finalize (GObject *object)
_g_object_list_unref (test->priv->tests);
if (test->priv->attributes != NULL)
g_string_free (test->priv->attributes, TRUE);
+ g_free (test->priv);
test->priv = NULL;
}
diff --git a/gthumb/gth-test.c b/gthumb/gth-test.c
index d1ae543..1620c94 100644
--- a/gthumb/gth-test.c
+++ b/gthumb/gth-test.c
@@ -81,6 +81,7 @@ gth_test_finalize (GObject *object)
self = GTH_TEST (object);
g_free (self->priv->id);
+ g_free (self->priv->attributes);
g_free (self->priv->display_name);
g_free (self->files);
diff --git a/gthumb/gth-thumb-loader.c b/gthumb/gth-thumb-loader.c
index ab23054..da291d9 100644
--- a/gthumb/gth-thumb-loader.c
+++ b/gthumb/gth-thumb-loader.c
@@ -332,7 +332,9 @@ load_data_unref (LoadData *load_data)
{
g_object_unref (load_data->thumb_loader);
g_object_unref (load_data->file_data);
+ _g_object_unref (load_data->simple);
_g_object_unref (load_data->cancellable);
+ g_free (load_data->thumbnailer_tmpfile);
g_free (load_data);
}
@@ -806,6 +808,7 @@ gth_thumb_loader_load (GthThumbLoader *self,
g_error_free (error);
g_free (uri);
+ g_object_unref (simple);
return;
}
@@ -826,6 +829,7 @@ gth_thumb_loader_load (GthThumbLoader *self,
g_simple_async_result_complete_in_idle (simple);
g_error_free (error);
+ g_object_unref (simple);
return;
}
diff --git a/gthumb/gth-time-selector.c b/gthumb/gth-time-selector.c
index d5041e2..b5dc55c 100644
--- a/gthumb/gth-time-selector.c
+++ b/gthumb/gth-time-selector.c
@@ -213,6 +213,8 @@ update_view_from_data (GthTimeSelector *self)
text = gth_datetime_strftime (self->priv->date_time, "%X");
entry = gtk_bin_get_child (GTK_BIN (self->priv->time_combo_box));
gtk_entry_set_text (GTK_ENTRY (entry), text);
+
+ g_free (text);
}
else {
GtkWidget *entry;
diff --git a/gthumb/gtk-utils.c b/gthumb/gtk-utils.c
index 4dbab46..e4c0381 100644
--- a/gthumb/gtk-utils.c
+++ b/gthumb/gtk-utils.c
@@ -482,7 +482,7 @@ _g_icon_get_pixbuf (GIcon *icon,
pixbuf = NULL;
if (G_IS_THEMED_ICON (icon))
pixbuf = get_themed_icon_pixbuf (G_THEMED_ICON (icon), size, theme);
- if (G_IS_FILE_ICON (icon))
+ else if (G_IS_FILE_ICON (icon))
pixbuf = get_file_icon_pixbuf (G_FILE_ICON (icon), size);
if (pixbuf == NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]