Check that the colors aren't NULL before calling gdk_color_free

2004-09-22  Rodney Dawes  <dobey@novell.com>

	* gnome-wp-item.c (gnome_wp_item_free):
	Check that the colors aren't NULL before calling gdk_color_free

	* gnome-wp-xml.c (gnome_wp_xml_load_xml):
	Check that the item isn't already listed, before we try to add
	the wallpaper to the list
	(gnome_wp_xml_load_list): Load XML files from the correct directory
This commit is contained in:
Rodney Dawes 2004-09-22 15:07:01 +00:00 committed by Rodney Dawes
parent 9cb21bffd5
commit 1be7aa7de7
3 changed files with 25 additions and 3 deletions

View file

@ -1,3 +1,13 @@
2004-09-22 Rodney Dawes <dobey@novell.com>
* gnome-wp-item.c (gnome_wp_item_free):
Check that the colors aren't NULL before calling gdk_color_free
* gnome-wp-xml.c (gnome_wp_xml_load_xml):
Check that the item isn't already listed, before we try to add
the wallpaper to the list
(gnome_wp_xml_load_list): Load XML files from the correct directory
2004-08-20 Frederic Crozat <fcrozat@mandrakesoft.com>
* gnome-wp-capplet.c: (gnome_wp_icon_theme_changed),

View file

@ -89,8 +89,11 @@ void gnome_wp_item_free (GnomeWPItem * item) {
g_free (item->pri_color);
g_free (item->sec_color);
gdk_color_free (item->pcolor);
gdk_color_free (item->scolor);
if (item->pcolor != NULL)
gdk_color_free (item->pcolor);
if (item->scolor != NULL)
gdk_color_free (item->scolor);
gnome_wp_info_free (item->fileinfo);
gnome_wp_info_free (item->uriinfo);

View file

@ -95,6 +95,7 @@ static void gnome_wp_xml_load_xml (GnomeWPCapplet * capplet,
xmlDoc * wplist;
xmlNode * root, * list, * wpa;
GdkColor color1, color2;
GnomeWPItem * item;
wplist = xmlParseFile (filename);
@ -151,6 +152,14 @@ 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);
if (item != NULL) {
gnome_wp_item_free (wp);
continue;
}
/* Verify the colors and alloc some GdkColors here */
if (wp->shade_type == NULL) {
wp->shade_type = gconf_client_get_string (capplet->client,
@ -240,7 +249,7 @@ void gnome_wp_xml_load_list (GnomeWPCapplet * capplet) {
for (i = 0; xdgdirs && xdgdirs[i]; i++) {
gchar * datadir;
datadir = g_build_filename (xdgdirs[i], "gnome-wallpaper-properties",
datadir = g_build_filename (xdgdirs[i], "gnome-background-properties",
NULL);
if (g_file_test (datadir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
gnome_vfs_directory_list_load (&list, datadir,