aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <xfce-dev@marcschink.de>2015-09-01 17:43:40 +0200
committerMarc Schink <xfce-dev@marcschink.de>2015-09-01 22:55:19 +0200
commit7eed5c068931151ee3ad4566955edad48bd7f1af (patch)
treec1dc0153c47de57819eced04c406101b903fe6c1
parent00ddb3cc9b9fe84e64b519eb1c1a74b5645856ae (diff)
Fix various memory leaks.zapb
-rw-r--r--src/image_list.c28
-rw-r--r--src/image_viewer.c3
-rw-r--r--src/main_window.c36
-rw-r--r--src/settings.c25
-rw-r--r--src/thumbnailer.c10
5 files changed, 90 insertions, 12 deletions
diff --git a/src/image_list.c b/src/image_list.c
index 8965bc0..d183e42 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -484,6 +484,8 @@ rstto_image_list_add_file (
path,
&t_iter);
+ gtk_tree_path_free (path);
+
/** TODO: update all iterators */
while (iter)
{
@@ -757,6 +759,8 @@ cb_rstto_read_file ( gpointer user_data )
files = g_new0 ( RsttoFile *, loader->n_files+1);
files[0] = rstto_file_new (child_file);
+ g_object_unref (child_file);
+
for (i = 0; i < loader->n_files; ++i)
{
files[i+1] = loader->files[i];
@@ -769,6 +773,8 @@ cb_rstto_read_file ( gpointer user_data )
loader->files = files;
loader->n_files++;
}
+
+ g_object_unref (file_info);
}
else
{
@@ -987,15 +993,22 @@ static void
rstto_image_list_iter_dispose (GObject *object)
{
RsttoImageListIter *iter = RSTTO_IMAGE_LIST_ITER(object);
- if (iter->priv->r_file)
- {
- iter->priv->r_file = NULL;
- }
- if (iter->priv->image_list)
+ if (iter->priv)
{
- iter->priv->image_list->priv->iterators = g_slist_remove (iter->priv->image_list->priv->iterators, iter);
- iter->priv->image_list= NULL;
+ if (iter->priv->r_file)
+ {
+ iter->priv->r_file = NULL;
+ }
+
+ if (iter->priv->image_list)
+ {
+ iter->priv->image_list->priv->iterators = g_slist_remove (iter->priv->image_list->priv->iterators, iter);
+ iter->priv->image_list= NULL;
+ }
+
+ g_free (iter->priv);
+ iter->priv = NULL;
}
}
@@ -1645,6 +1658,7 @@ cb_rstto_thumbnailer_ready(
gtk_tree_model_get_iter (GTK_TREE_MODEL (image_list), &iter, path_);
gtk_tree_model_row_changed (GTK_TREE_MODEL(image_list), path_, &iter);
+ gtk_tree_path_free (path_);
}
}
diff --git a/src/image_viewer.c b/src/image_viewer.c
index 0e91346..2b1b0bd 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -558,6 +558,9 @@ rstto_image_viewer_realize(GtkWidget *widget)
}
viewer->priv->bg_color_fs = g_value_get_boxed (&val_bg_color_fs);
+
+ g_value_unset (&val_bg_color);
+ g_value_unset (&val_bg_color_fs);
}
/**
diff --git a/src/main_window.c b/src/main_window.c
index 38db54c..10e7e95 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -1174,18 +1174,36 @@ rstto_main_window_dispose(GObject *object)
window->priv->image_list = NULL;
}
+ if (window->priv->iter)
+ {
+ g_object_unref (window->priv->iter);
+ window->priv->iter = NULL;
+ }
+
if (window->priv->filter)
{
g_object_unref (window->priv->filter);
window->priv->filter= NULL;
}
+ if (window->priv->db)
+ {
+ g_object_unref (window->priv->db);
+ window->priv->db = NULL;
+ }
+
if (window->priv->thumbnailer)
{
g_object_unref (window->priv->thumbnailer);
window->priv->thumbnailer = NULL;
}
+ if (window->priv->action_group)
+ {
+ g_object_unref (window->priv->action_group);
+ window->priv->action_group = NULL;
+ }
+
if (window->priv->last_copy_folder_uri)
{
g_free (window->priv->last_copy_folder_uri);
@@ -1279,6 +1297,7 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window)
GtkWidget *menu_item = NULL;
GDesktopAppInfo *app_info = NULL;
const GdkPixbuf *pixbuf = NULL;
+ GdkPixbuf *tmp;
GtkWidget *open_with_menu = gtk_menu_new();
GtkWidget *open_with_window_menu = gtk_menu_new();
@@ -1305,7 +1324,9 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window)
pixbuf = rstto_file_get_thumbnail (cur_file, THUMBNAIL_SIZE_SMALL);
if (pixbuf != NULL)
{
- gtk_window_set_icon (GTK_WINDOW (window), gdk_pixbuf_copy (pixbuf));
+ tmp = gdk_pixbuf_copy (pixbuf);
+ gtk_window_set_icon (GTK_WINDOW (window), tmp);
+ g_object_unref (tmp);
}
else
{
@@ -2918,6 +2939,7 @@ cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
GValue current_uri_val = {0, };
GtkFileFilter *filter;
RsttoFile *r_file = NULL;
+ gchar *tmp;
g_value_init (&current_uri_val, G_TYPE_STRING);
g_object_get_property (G_OBJECT(window->priv->settings_manager), "current-uri", &current_uri_val);
@@ -3042,10 +3064,11 @@ cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
}
}
}
-
- g_value_set_string (&current_uri_val, gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dialog)));
- g_object_set_property (G_OBJECT(window->priv->settings_manager), "current-uri", &current_uri_val);
+ tmp = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dialog));
+ g_value_take_string (&current_uri_val, tmp);
+ g_object_set_property (G_OBJECT(window->priv->settings_manager), "current-uri", &current_uri_val);
+ g_value_unset (&current_uri_val);
}
gtk_widget_destroy(dialog);
@@ -4239,13 +4262,16 @@ cb_rstto_thumbnailer_ready(
RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data);
RsttoFile *cur_file = rstto_image_list_iter_get_file (window->priv->iter);
const GdkPixbuf *pixbuf = NULL;
+ GdkPixbuf *tmp;
if (file == cur_file)
{
pixbuf = rstto_file_get_thumbnail (file, THUMBNAIL_SIZE_SMALL);
if (pixbuf != NULL)
{
- gtk_window_set_icon (GTK_WINDOW (window), gdk_pixbuf_copy(pixbuf));
+ tmp = gdk_pixbuf_copy (pixbuf);
+ gtk_window_set_icon (GTK_WINDOW (window), tmp);
+ g_object_unref (tmp);
}
else
{
diff --git a/src/settings.c b/src/settings.c
index d279010..6f75661 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -629,6 +629,31 @@ rstto_settings_dispose (GObject *object)
g_object_unref (settings->priv->channel);
settings->priv->channel = NULL;
}
+
+ if (settings->priv->last_file_path)
+ {
+ g_free (settings->priv->last_file_path);
+ settings->priv->last_file_path = NULL;
+ }
+
+ if (settings->priv->navigationbar_position)
+ {
+ g_free (settings->priv->navigationbar_position);
+ settings->priv->navigationbar_position = NULL;
+ }
+
+ if (settings->priv->bgcolor)
+ {
+ g_free (settings->priv->bgcolor);
+ settings->priv->bgcolor = NULL;
+ }
+
+ if (settings->priv->bgcolor_fullscreen)
+ {
+ g_free (settings->priv->bgcolor_fullscreen);
+ settings->priv->bgcolor_fullscreen = NULL;
+ }
+
g_free (settings->priv);
settings->priv = NULL;
}
diff --git a/src/thumbnailer.c b/src/thumbnailer.c
index 14ec6b0..44fd681 100644
--- a/src/thumbnailer.c
+++ b/src/thumbnailer.c
@@ -240,6 +240,13 @@ rstto_thumbnailer_dispose (GObject *object)
g_object_unref (thumbnailer->priv->settings);
thumbnailer->priv->settings = NULL;
}
+
+ if (thumbnailer->priv->proxy)
+ {
+ g_object_unref (thumbnailer->priv->proxy);
+ thumbnailer->priv->proxy = NULL;
+ }
+
g_free (thumbnailer->priv);
thumbnailer->priv = NULL;
}
@@ -493,6 +500,9 @@ rstto_thumbnailer_queue_request_timer (
/* TOOO: Nice cleanup */
}
+ g_free (uris);
+ g_free (mimetypes);
+
thumbnailer->priv->request_timer_id = 0;
return FALSE;
}