gnome-control-center r9144 - in trunk: . font-viewer
- From: jensg svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-control-center r9144 - in trunk: . font-viewer
- Date: Tue, 18 Nov 2008 20:04:02 +0000 (UTC)
Author: jensg
Date: Tue Nov 18 20:04:02 2008
New Revision: 9144
URL: http://svn.gnome.org/viewvc/gnome-control-center?rev=9144&view=rev
Log:
2008-11-18 Jens Granseuer <jensgr gmx net>
* font-viewer/font-view.c: (add_face_info), (set_icon):
* font-viewer/ftstream-vfs.c: (vfs_stream_open): fix another
leak, an invalid free, and a simplify error handling
Modified:
trunk/ChangeLog
trunk/font-viewer/font-view.c
trunk/font-viewer/ftstream-vfs.c
Modified: trunk/font-viewer/font-view.c
==============================================================================
--- trunk/font-viewer/font-view.c (original)
+++ trunk/font-viewer/font-view.c Tue Nov 18 20:04:02 2008
@@ -157,7 +157,7 @@
/* calculate size of pixmap to use (with 4 pixels padding) ... */
pixmap_width = 8;
pixmap_height = 8;
-
+
font = get_font(xdisplay, face, alpha_size, charset);
charset = FcCharSetCopy (font->charset);
XftTextExtentsUtf8(xdisplay, font,
@@ -284,6 +284,7 @@
G_FILE_ATTRIBUTE_STANDARD_SIZE,
G_FILE_QUERY_INFO_NONE,
NULL, NULL);
+ g_object_unref (file);
if (info) {
s = g_content_type_get_description (g_file_info_get_content_type (info));
@@ -297,8 +298,6 @@
g_object_unref (info);
}
- g_object_unref (file);
-
if (FT_IS_SFNT(face)) {
gint i, len;
gchar *version = NULL, *copyright = NULL, *description = NULL;
@@ -376,7 +375,7 @@
GFileInfo *info;
GdkScreen *screen;
GtkIconTheme *icon_theme;
- gchar *icon_name = NULL, *content_type = NULL;
+ const gchar *icon_name = NULL, *content_type;
screen = gtk_widget_get_screen (GTK_WIDGET (window));
icon_theme = gtk_icon_theme_get_for_screen (screen);
@@ -385,10 +384,10 @@
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
G_FILE_QUERY_INFO_NONE, NULL, NULL);
- if (! info) {
- g_object_unref (file);
+ g_object_unref (file);
+
+ if (! info)
return;
- }
content_type = g_file_info_get_content_type (info);
icon = g_content_type_get_icon (content_type);
@@ -399,21 +398,20 @@
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
if (names) {
gint i;
- for (i = 0; names[i]; i++)
+ for (i = 0; names[i]; i++) {
if (gtk_icon_theme_has_icon (icon_theme, names[i])) {
- icon_name = g_strdup (names[i]);
+ icon_name = names[i];
break;
}
+ }
}
}
if (icon_name) {
gtk_window_set_icon_name (window, icon_name);
- g_free (icon_name);
}
g_object_unref (icon);
- g_free (content_type);
}
int
@@ -449,7 +447,7 @@
if (error) {
g_printerr("could not initialise freetype\n");
return 1;
- }
+ }
file = g_file_new_for_commandline_arg (argv[1]);
font_file = g_file_get_uri (file);
Modified: trunk/font-viewer/ftstream-vfs.c
==============================================================================
--- trunk/font-viewer/ftstream-vfs.c (original)
+++ trunk/font-viewer/ftstream-vfs.c Tue Nov 18 20:04:02 2008
@@ -89,17 +89,17 @@
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_SIZE,
G_FILE_QUERY_INFO_NONE, NULL, &error);
+ g_object_unref (file);
+
if (! info) {
g_warning (error->message);
g_error_free (error);
- g_object_unref (file);
return FT_Err_Cannot_Open_Resource;
}
stream->size = g_file_info_get_size (info);
- g_object_unref (file);
g_object_unref (info);
stream->descriptor.pointer = handle;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]