If the filename is not encoded in UTF-8, we just ignore it for now to

2005-02-26  Rodney Dawes  <dobey@novell.com>

	* gnome-wp-capplet.c (gnome_wp_add_image): If the filename is not
	encoded in UTF-8, we just ignore it for now to avoid crashing

	* gnome-wp-xml.c (gnome_wp_xml_load_xml): Check to make sure that the
	filename and name tags that we read in, aren't NULL
	If the filename we read in is NULL, free the item, and continue on

	Fixes #146130 #146645 (resolving these as dups of #168604 )
	Fixes #159441
This commit is contained in:
Rodney Dawes 2005-02-26 19:00:19 +00:00 committed by Rodney Dawes
parent 8dd93b12a7
commit c15683e8ff
3 changed files with 27 additions and 6 deletions

View file

@ -1,3 +1,15 @@
2005-02-26 Rodney Dawes <dobey@novell.com>
* gnome-wp-capplet.c (gnome_wp_add_image): If the filename is not
encoded in UTF-8, we just ignore it for now to avoid crashing
* gnome-wp-xml.c (gnome_wp_xml_load_xml): Check to make sure that the
filename and name tags that we read in, aren't NULL
If the filename we read in is NULL, free the item, and continue on
Fixes #146130 #146645 (resolving these as dups of #168604 )
Fixes #159441
2005-02-06 Rodney Dawes <dobey@novell.com>
* gnome-wp-capplet.c (wallpaper_properties_init): Force using the gtk+

View file

@ -93,6 +93,9 @@ static GnomeWPItem * gnome_wp_add_image (GnomeWPCapplet * capplet,
const gchar * filename) {
GnomeWPItem * item;
if (!g_utf8_validate (filename, -1, NULL))
return NULL;
item = g_hash_table_lookup (capplet->wphash, filename);
if (item != NULL) {
if (item->deleted) {

View file

@ -118,13 +118,13 @@ static void gnome_wp_xml_load_xml (GnomeWPCapplet * capplet,
for (wpa = list->children; wpa != NULL; wpa = wpa->next) {
if (!strcmp (wpa->name, "filename")) {
if (wpa->last != NULL) {
if (wpa->last != NULL && wpa->last->content != NULL) {
wp->filename = g_strdup (g_strstrip (wpa->last->content));
} else {
break;
}
} else if (!strcmp (wpa->name, "name")) {
if (wpa->last != NULL) {
if (wpa->last != NULL && wpa->last->content != NULL) {
nodelang = xmlNodeGetLang (wpa->last);
if (wp->name == NULL && nodelang == NULL) {
@ -138,6 +138,8 @@ static void gnome_wp_xml_load_xml (GnomeWPCapplet * capplet,
}
xmlFree (nodelang);
} else {
break;
}
} else if (!strcmp (wpa->name, "imguri")) {
if (wpa->last != NULL) {
@ -169,11 +171,15 @@ static void gnome_wp_xml_load_xml (GnomeWPCapplet * capplet,
}
}
/* Make sure we don't already have this one */
item = g_hash_table_lookup (capplet->wphash, wp->filename);
/* Make sure we don't already have this one and that filename exists */
if (wp->filename != NULL) {
item = g_hash_table_lookup (capplet->wphash, wp->filename);
if (item != NULL) {
gnome_wp_item_free (wp);
if (item != NULL) {
gnome_wp_item_free (wp);
continue;
}
} else {
continue;
}