[Goodies-commits] r2916 - ristretto/trunk/src
Stephan Arts
stephan at xfce.org
Mon Jul 16 09:54:50 CEST 2007
Author: stephan
Date: 2007-07-16 07:54:49 +0000 (Mon, 16 Jul 2007)
New Revision: 2916
Modified:
ristretto/trunk/src/main.c
Log:
fix memory leaks
Modified: ristretto/trunk/src/main.c
===================================================================
--- ristretto/trunk/src/main.c 2007-07-15 23:14:15 UTC (rev 2915)
+++ ristretto/trunk/src/main.c 2007-07-16 07:54:49 UTC (rev 2916)
@@ -117,6 +117,9 @@
rstto_picture_viewer_set_pixbuf(RSTTO_PICTURE_VIEWER(viewer), pixbuf);
+ if(pixbuf)
+ g_object_unref(pixbuf);
+
gtk_widget_set_size_request(window, 300, 200);
@@ -230,6 +233,8 @@
pixbuf = gdk_pixbuf_new_from_file(filename , NULL);
rstto_picture_viewer_set_pixbuf(RSTTO_PICTURE_VIEWER(viewer), pixbuf);
+
+ g_object_unref(pixbuf);
}
gtk_widget_destroy(dialog);
@@ -239,7 +244,8 @@
cb_rstto_forward(GtkToolItem *item, RsttoPictureViewer *viewer)
{
GdkPixbuf *pixbuf;
- file_iter = g_list_next(file_iter);
+ if(file_iter)
+ file_iter = g_list_next(file_iter);
if(!file_iter)
file_iter = file_list;
@@ -250,6 +256,9 @@
pixbuf = gdk_pixbuf_new_from_file(filename , NULL);
rstto_picture_viewer_set_pixbuf(RSTTO_PICTURE_VIEWER(viewer), pixbuf);
+
+ if(pixbuf)
+ g_object_unref(pixbuf);
g_free(filename);
}
}
@@ -258,7 +267,8 @@
cb_rstto_back(GtkToolItem *item, RsttoPictureViewer *viewer)
{
GdkPixbuf *pixbuf;
- file_iter = g_list_previous(file_iter);
+ if(file_iter)
+ file_iter = g_list_previous(file_iter);
if(!file_iter)
file_iter = g_list_last(file_list);
@@ -269,6 +279,9 @@
pixbuf = gdk_pixbuf_new_from_file(filename , NULL);
rstto_picture_viewer_set_pixbuf(RSTTO_PICTURE_VIEWER(viewer), pixbuf);
+
+ if(pixbuf)
+ g_object_unref(pixbuf);
g_free(filename);
}
}
More information about the Goodies-commits
mailing list