diff src/pan-view.c @ 767:e73d30e0c896

Make utf8_validate_or_convert() to always allocate a new string.
author zas_
date Fri, 30 May 2008 08:36:23 +0000
parents 477f48ba28d8
children d6a7fb4b8e7c
line wrap: on
line diff
--- a/src/pan-view.c	Fri May 30 07:20:25 2008 +0000
+++ b/src/pan-view.c	Fri May 30 08:36:23 2008 +0000
@@ -1444,21 +1444,23 @@
 		{
 		gchar *label;
 		gchar *text;
+		gchar *utf8_text;
 
 		if (ExifUIList[i].current == EXIF_UI_OFF) continue;
 
 		text = exif_get_data_as_text(exif, ExifUIList[i].key);
-		text = utf8_validate_or_convert(text);
 		if (ExifUIList[i].current == EXIF_UI_IFSET && (!text || !*text))
 			{
-			if (text) g_free(text);
+			g_free(text);
 			continue;
 			}
-
+		
 		label = g_strdup_printf("%s:", exif_get_description_by_key(ExifUIList[i].key));
-		pan_text_alignment_add(ta, label, text);
+		utf8_text = utf8_validate_or_convert(text);
+		g_free(text);
+		pan_text_alignment_add(ta, label, utf8_text);
 		g_free(label);
-		g_free(text);
+		g_free(utf8_text);
 		}
 
 	work = g_list_last(history_list_get_by_key("exif_extras"));
@@ -1466,18 +1468,22 @@
 	while (work)
 		{
 		const gchar *name;
-		gchar *label;
 		gchar *text;
 
 		name = work->data;
 		work = work->prev;
 
-		label = g_strdup_printf("%s:", name);
 		text = exif_get_data_as_text(exif, name);
-		text = utf8_validate_or_convert(text);
-		pan_text_alignment_add(ta, label, text);
-		g_free(label);
-		g_free(text);
+		if (text)
+			{
+			gchar *label = g_strdup_printf("%s:", name);
+			gchar *utf8_text = utf8_validate_or_convert(text);
+
+			g_free(text);
+			pan_text_alignment_add(ta, label, utf8_text);
+			g_free(label);
+			g_free(utf8_text);
+			}
 		}
 
 	exif_free(exif);