copy the name for the default cursor, too, lest we crash on free, and only

2007-08-07  Jens Granseuer  <jensgr@gmx.net>

	* gnome-theme-info.c: (read_cursor_theme),
	(gnome_theme_cursor_info_free): copy the name for the default cursor,
	too, lest we crash on free, and only unref the thumbnail if we have
	one

svn path=/trunk/; revision=7971
This commit is contained in:
Jens Granseuer 2007-08-07 19:44:18 +00:00 committed by Jens Granseuer
parent 44eec9e2a3
commit 69749b7dcb
2 changed files with 15 additions and 6 deletions

View file

@ -1,3 +1,10 @@
2007-08-07 Jens Granseuer <jensgr@gmx.net>
* gnome-theme-info.c: (read_cursor_theme),
(gnome_theme_cursor_info_free): copy the name for the default cursor,
too, lest we crash on free, and only unref the thumbnail if we have
one
2007-07-28 Denis Washington <denisw@svn.gnome.org> 2007-07-28 Denis Washington <denisw@svn.gnome.org>
* gnome-theme-info.c: (read_cursor_theme), (look_for_cursor_theme): * gnome-theme-info.c: (read_cursor_theme), (look_for_cursor_theme):

View file

@ -1007,14 +1007,15 @@ read_cursor_theme (const gchar *theme_dir)
XcursorImage *cursor; XcursorImage *cursor;
GdkPixbuf *thumbnail = NULL; GdkPixbuf *thumbnail = NULL;
GnomeThemeCursorInfo *cursor_theme_info; GnomeThemeCursorInfo *cursor_theme_info;
const gint sizes[] = { 12, 16, 24, 32, 36, 40, 48, 64, 0 }; const gint sizes[] = { 12, 16, 24, 32, 36, 40, 48, 64 };
const gint num_sizes = G_N_ELEMENTS (sizes);
name = g_path_get_basename (theme_dir); name = g_path_get_basename (theme_dir);
available_sizes = g_array_sized_new (FALSE, FALSE, sizeof (gint), available_sizes = g_array_sized_new (FALSE, FALSE, sizeof (gint),
G_N_ELEMENTS (sizes) - 1); num_sizes);
for (i = 0; sizes[i] != 0; i++) { for (i = 0; i < num_sizes; i++) {
cursor = XcursorLibraryLoadImage ("left_ptr", name, sizes[i]); cursor = XcursorLibraryLoadImage ("left_ptr", name, sizes[i]);
if (cursor) { if (cursor) {
@ -1045,7 +1046,7 @@ read_cursor_theme (const gchar *theme_dir)
cursor_theme_info->priority = 0; cursor_theme_info->priority = 0;
if (!strcmp (name, "default")) { if (!strcmp (name, "default")) {
cursor_theme_info->readable_name = _("Default Pointer"); cursor_theme_info->readable_name = g_strdup (_("Default Pointer"));
} else { } else {
gchar *cursor_theme_file; gchar *cursor_theme_file;
GnomeDesktopItem *cursor_theme_ditem; GnomeDesktopItem *cursor_theme_ditem;
@ -1057,7 +1058,7 @@ read_cursor_theme (const gchar *theme_dir)
if (cursor_theme_ditem) { if (cursor_theme_ditem) {
const gchar *readable_name; const gchar *readable_name;
readable_name = (gchar *) gnome_desktop_item_get_string (cursor_theme_ditem, "Icon Theme/Name"); readable_name = gnome_desktop_item_get_string (cursor_theme_ditem, "Icon Theme/Name");
if (readable_name) if (readable_name)
cursor_theme_info->readable_name = g_strdup (readable_name); cursor_theme_info->readable_name = g_strdup (readable_name);
@ -1508,7 +1509,8 @@ gnome_theme_cursor_info_free (GnomeThemeCursorInfo *cursor_theme_info)
g_free (cursor_theme_info->readable_name); g_free (cursor_theme_info->readable_name);
g_free (cursor_theme_info->path); g_free (cursor_theme_info->path);
g_array_free (cursor_theme_info->sizes, TRUE); g_array_free (cursor_theme_info->sizes, TRUE);
g_object_unref (cursor_theme_info->thumbnail); if (cursor_theme_info->thumbnail != NULL)
g_object_unref (cursor_theme_info->thumbnail);
g_free (cursor_theme_info); g_free (cursor_theme_info);
} }