fix another leak, an invalid free, and a simplify error handling
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 svn path=/trunk/; revision=9144
This commit is contained in:
parent
afbe70bca0
commit
cabbecfa4b
3 changed files with 18 additions and 14 deletions
|
@ -1,3 +1,9 @@
|
|||
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
|
||||
|
||||
2008-11-18 Rodrigo Moya <rodrigo@gnome-db.org>
|
||||
|
||||
* font-viewer/font-view.c (set_icon): don't leak icon_name.
|
||||
|
|
|
@ -284,6 +284,7 @@ add_face_info(GtkWidget *table, gint *row_p, const gchar *uri, FT_Face face)
|
|||
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 @@ add_face_info(GtkWidget *table, gint *row_p, const gchar *uri, FT_Face face)
|
|||
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 @@ set_icon(GtkWindow *window, const gchar *uri)
|
|||
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 @@ set_icon(GtkWindow *window, const gchar *uri)
|
|||
|
||||
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);
|
||||
|
||||
if (! info)
|
||||
return;
|
||||
}
|
||||
|
||||
content_type = g_file_info_get_content_type (info);
|
||||
icon = g_content_type_get_icon (content_type);
|
||||
|
@ -399,21 +398,20 @@ set_icon(GtkWindow *window, const gchar *uri)
|
|||
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
|
||||
|
|
|
@ -89,17 +89,17 @@ vfs_stream_open(FT_Stream stream,
|
|||
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue