[Xfce4-commits] <ristretto:master> Cleanup some memory-leaks
Stephan Arts
noreply at xfce.org
Sat Oct 22 20:56:01 CEST 2011
Updating branch refs/heads/master
to 0bba0d0975588c4df87daa4504f12a7b2cfe63a7 (commit)
from f51aefbff481303cece1c45ebdd0566d30ac7e48 (commit)
commit 0bba0d0975588c4df87daa4504f12a7b2cfe63a7
Author: Stephan Arts <stephan at xfce.org>
Date: Sat Oct 22 20:49:24 2011 +0200
Cleanup some memory-leaks
src/image_viewer.c | 5 +++++
src/main_window.c | 47 +++++++++++++++++++++++++++++++----------------
src/thumbnail.c | 13 +++++++++++++
3 files changed, 49 insertions(+), 16 deletions(-)
diff --git a/src/image_viewer.c b/src/image_viewer.c
index bb20a11..91b59c4 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -523,6 +523,11 @@ rstto_image_viewer_destroy(GtkObject *object)
g_object_unref (viewer->priv->settings);
viewer->priv->settings = NULL;
}
+ if (viewer->priv->bg_icon)
+ {
+ g_object_unref (viewer->priv->bg_icon);
+ viewer->priv->bg_icon = NULL;
+ }
}
static gboolean
diff --git a/src/main_window.c b/src/main_window.c
index 9d9b0b1..127c111 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -2597,7 +2597,7 @@ cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
gint response;
GFile *file;
GFile *p_file;
- GFileEnumerator *file_enumarator = NULL;
+ GFileEnumerator *file_enumerator = NULL;
GSList *files = NULL, *_files_iter;
GValue current_uri_val = {0, };
GtkFileFilter *filter;
@@ -2684,16 +2684,23 @@ cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
rstto_image_list_add_file (window->priv->props.image_list, rfile, NULL);
}
p_file = g_file_get_parent (files->data);
- file_enumarator = g_file_enumerate_children (p_file, "standard::*", 0, NULL, NULL);
- for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
+ file_enumerator = g_file_enumerate_children (p_file, "standard::*", 0, NULL, NULL);
+ if (NULL != file_enumerator)
{
- filename = g_file_info_get_name (file_info);
- content_type = g_file_info_get_content_type (file_info);
- child_file = g_file_get_child (p_file, filename);
- if (strncmp (content_type, "image/", 6) == 0)
+ for(file_info = g_file_enumerator_next_file (file_enumerator, NULL, NULL);
+ file_info != NULL;
+ file_info = g_file_enumerator_next_file (file_enumerator, NULL, NULL))
{
- rstto_image_list_add_file (window->priv->props.image_list, rstto_file_new (child_file), NULL);
+ filename = g_file_info_get_name (file_info);
+ content_type = g_file_info_get_content_type (file_info);
+ child_file = g_file_get_child (p_file, filename);
+ if (strncmp (content_type, "image/", 6) == 0)
+ {
+ rstto_image_list_add_file (window->priv->props.image_list, rstto_file_new (child_file), NULL);
+ }
}
+ g_object_unref (file_enumerator);
+ file_enumerator = NULL;
}
}
rstto_image_list_iter_find_file (
@@ -2732,7 +2739,7 @@ cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *win
GError *error = NULL;
GFile *file = g_file_new_for_uri (uri);
GFile *child_file, *p_file;
- GFileEnumerator *file_enumarator = NULL;
+ GFileEnumerator *file_enumerator = NULL;
GFileInfo *file_info = g_file_query_info (file, "standard::type", 0, NULL, &error);
RsttoFile *rfile;
@@ -2746,20 +2753,28 @@ cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *win
rstto_image_list_add_file (window->priv->props.image_list, rfile, NULL);
}
p_file = g_file_get_parent (file);
- file_enumarator = g_file_enumerate_children (p_file, "standard::*", 0, NULL, NULL);
- for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
+ file_enumerator = g_file_enumerate_children (p_file, "standard::*", 0, NULL, NULL);
+ if (NULL != file_enumerator)
{
- filename = g_file_info_get_name (file_info);
- content_type = g_file_info_get_content_type (file_info);
- child_file = g_file_get_child (p_file, filename);
- if (strncmp (content_type, "image/", 6) == 0)
+ for(file_info = g_file_enumerator_next_file (file_enumerator, NULL, NULL);
+ file_info != NULL;
+ file_info = g_file_enumerator_next_file (file_enumerator, NULL, NULL))
{
- rstto_image_list_add_file (window->priv->props.image_list, rstto_file_new (child_file), NULL);
+ filename = g_file_info_get_name (file_info);
+ content_type = g_file_info_get_content_type (file_info);
+ child_file = g_file_get_child (p_file, filename);
+ if (strncmp (content_type, "image/", 6) == 0)
+ {
+ rstto_image_list_add_file (window->priv->props.image_list, rstto_file_new (child_file), NULL);
+ }
}
+ g_object_unref (file_enumerator);
+ file_enumerator = NULL;
}
rstto_image_list_iter_find_file (
window->priv->iter,
rfile );
+
}
else
{
diff --git a/src/thumbnail.c b/src/thumbnail.c
index f51af27..67876fc 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -143,6 +143,19 @@ rstto_thumbnail_finalize(GObject *object)
g_object_unref (thumb->priv->file);
thumb->priv->file = NULL;
}
+
+ if (thumb->priv->pixbuf)
+ {
+ g_object_unref (thumb->priv->pixbuf);
+ thumb->priv->pixbuf = NULL;
+ }
+
+ if (thumb->priv->thumbnail_path)
+ {
+ g_free (thumb->priv->thumbnail_path);
+ thumb->priv->thumbnail_path = NULL;
+ }
+
if (thumb->priv->thumb_pixbuf)
{
g_object_unref (thumb->priv->thumb_pixbuf);
More information about the Xfce4-commits
mailing list