Commit c6999951 authored by Marc Schink's avatar Marc Schink Committed by Eric Koegel

Fix various memory leaks.

Signed-off-by: default avatarEric Koegel <eric.koegel@gmail.com>
parent b9b88e9e
......@@ -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_);
}
}
......
......@@ -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);
}
/**
......
......@@ -1170,17 +1170,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;
}
g_free (window->priv);
window->priv = NULL;
}
......@@ -1268,6 +1287,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();
......@@ -1294,7 +1314,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
{
......@@ -2907,6 +2929,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);
......@@ -3031,10 +3054,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);
......@@ -4211,13 +4235,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
{
......
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment