[maemo-commits] [maemo-commits] r18256 - in projects/haf/trunk/hildon-thumbnail: . daemon/plugins

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed May 6 13:23:42 EEST 2009
Author: pvanhoof
Date: 2009-05-06 13:23:33 +0300 (Wed, 06 May 2009)
New Revision: 18256

Modified:
   projects/haf/trunk/hildon-thumbnail/ChangeLog
   projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c
   projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c
Log:
2009-05-06  Philip Van Hoof  <pvanhoof at codeminded.be>

        * daemon/plugins/gdkpixbuf-plugin.c
        * daemon/plugins/epeg-plugin.c: Memleak fix



Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-thumbnail/ChangeLog	2009-05-06 07:51:40 UTC (rev 18255)
+++ projects/haf/trunk/hildon-thumbnail/ChangeLog	2009-05-06 10:23:33 UTC (rev 18256)
@@ -1,3 +1,8 @@
+2009-05-06  Philip Van Hoof  <pvanhoof at codeminded.be>
+
+	* daemon/plugins/gdkpixbuf-plugin.c
+	* daemon/plugins/epeg-plugin.c: Memleak fix
+
 2009-05-05  Philip Van Hoof  <pvanhoof at codeminded.be>
 
 	* daemon/hildon-thumbnail-daemon.c: Disabled IDLE priority, thumbnails

Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c
===================================================================
--- projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c	2009-05-06 07:51:40 UTC (rev 18255)
+++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c	2009-05-06 10:23:33 UTC (rev 18256)
@@ -209,18 +209,33 @@
 				goto nerror_handler;
 
 		} else {
+			//gchar *large=NULL, *normal=NULL, *cropped=NULL;
 
 			epeg_decode_colorspace_set (im, EPEG_RGB8);
 			epeg_decode_size_set (im, 256, 256);
-			epeg_quality_set (im, 80);
+			epeg_quality_set (im, 75);
 			epeg_thumbnail_comments_enable (im, 0);
 
+			//hildon_thumbnail_util_get_thumb_paths (uri, &large, &normal, &cropped,
+			//				       NULL, NULL, NULL, FALSE);
+
+			//epeg_file_output_set (im, large);
+			//epeg_encode (im);
+			//epeg_close (im);
+
+			//pixbuf_large = gdk_pixbuf_new_from_file (large, &nerror);
+
+			//if (nerror)
+			//	goto nerror_handler;
+
 			data = (guchar *) epeg_pixels_get (im, 0, 0, 256, 256);
 
 			pixbuf_large = gdk_pixbuf_new_from_data ((const guchar*) data, 
 									  GDK_COLORSPACE_RGB, FALSE, 
 									  8, 256, 256, 256*3,
 									  destroy_pixbuf, im);
+
+			
 		}
 
 		if (hildon_thumbnail_outplugins_needs_out (HILDON_THUMBNAIL_PLUGIN_OUTTYPE_LARGE, mtime, uri)) {

Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c
===================================================================
--- projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c	2009-05-06 07:51:40 UTC (rev 18255)
+++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c	2009-05-06 10:23:33 UTC (rev 18256)
@@ -170,7 +170,7 @@
 		GError *nerror = NULL;
 		GFileInfo *info;
 		GFile *file;
-		GFileInputStream *stream;
+		GFileInputStream *stream=NULL;
 		gchar *uri = uris[i];
 		GdkPixbuf *pixbuf_large;
 		GdkPixbuf *pixbuf_normal;
@@ -203,16 +203,19 @@
 
 		if (hildon_thumbnail_outplugins_needs_out (HILDON_THUMBNAIL_PLUGIN_OUTTYPE_LARGE, mtime, uri)) {
 
-			pixbuf_large = gdk_pixbuf_new_from_stream_at_scale (G_INPUT_STREAM (stream),
+			GdkPixbuf *pixbuf_large1 = gdk_pixbuf_new_from_stream_at_scale (G_INPUT_STREAM (stream),
 									    256, 256,
 									    TRUE,
 									    NULL,
 									    &nerror);
 
-			if (nerror)
+			if (nerror) {
+				if (pixbuf_large1)
+					g_object_unref (pixbuf_large1);
 				goto nerror_handler;
+			}
 
-			pixbuf_large = gdk_pixbuf_apply_embedded_orientation (pixbuf_large);
+			pixbuf_large = gdk_pixbuf_apply_embedded_orientation (pixbuf_large1);
 
 			rgb8_pixels = gdk_pixbuf_get_pixels (pixbuf_large);
 			width = gdk_pixbuf_get_width (pixbuf_large);
@@ -231,7 +234,7 @@
 							    &nerror);
 
 			g_object_unref (pixbuf_large);
-			g_object_unref (pixbuf_large);
+			g_object_unref (pixbuf_large1);
 
 			if (nerror)
 				goto nerror_handler;
@@ -246,16 +249,19 @@
 
 		if (hildon_thumbnail_outplugins_needs_out (HILDON_THUMBNAIL_PLUGIN_OUTTYPE_NORMAL, mtime, uri)) {
 
-			pixbuf_normal = gdk_pixbuf_new_from_stream_at_scale (G_INPUT_STREAM (stream),
+			GdkPixbuf *pixbuf_normal1 = gdk_pixbuf_new_from_stream_at_scale (G_INPUT_STREAM (stream),
 									     128, 128,
 									     TRUE,
 									     NULL,
 									     &nerror);
 
-			if (nerror)
+			if (nerror) {
+				if (pixbuf_normal1)
+					g_object_unref (pixbuf_normal1);
 				goto nerror_handler;
+			}
 
-			pixbuf_normal = gdk_pixbuf_apply_embedded_orientation (pixbuf_normal);
+			pixbuf_normal = gdk_pixbuf_apply_embedded_orientation (pixbuf_normal1);
 
 			rgb8_pixels = gdk_pixbuf_get_pixels (pixbuf_normal);
 			width = gdk_pixbuf_get_width (pixbuf_normal);
@@ -274,7 +280,7 @@
 							    &nerror);
 
 			g_object_unref (pixbuf_normal);
-			g_object_unref (pixbuf_normal);
+			g_object_unref (pixbuf_normal1);
 
 			if (nerror)
 				goto nerror_handler;
@@ -288,19 +294,22 @@
 
 		if (do_cropped && hildon_thumbnail_outplugins_needs_out (HILDON_THUMBNAIL_PLUGIN_OUTTYPE_CROPPED, mtime, uri)) {
 
-			pixbuf = gdk_pixbuf_new_from_stream (G_INPUT_STREAM (stream),
+			GdkPixbuf *pixbuf1 = gdk_pixbuf_new_from_stream (G_INPUT_STREAM (stream),
 							     NULL,
 							     &nerror);
 
-			if (nerror)
+			if (nerror) {
+				if (pixbuf1)
+					g_object_unref (pixbuf1);
 				goto nerror_handler;
+			}
 
-			pixbuf = gdk_pixbuf_apply_embedded_orientation (pixbuf);
+			pixbuf = gdk_pixbuf_apply_embedded_orientation (pixbuf1);
 
 			pixbuf_cropped = crop_resize (pixbuf, 124, 124);
 
 			g_object_unref (pixbuf);
-			g_object_unref (pixbuf);
+			g_object_unref (pixbuf1);
 
 			rgb8_pixels = gdk_pixbuf_get_pixels (pixbuf_cropped);
 			width = gdk_pixbuf_get_width (pixbuf_cropped);


More information about the maemo-commits mailing list