From 1be7aa7de78930dd3138577d5ecd3de6dea5dd9b Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Wed, 22 Sep 2004 15:07:01 +0000 Subject: [PATCH] Check that the colors aren't NULL before calling gdk_color_free 2004-09-22 Rodney Dawes * 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 --- capplets/background/ChangeLog | 10 ++++++++++ capplets/background/gnome-wp-item.c | 7 +++++-- capplets/background/gnome-wp-xml.c | 11 ++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/capplets/background/ChangeLog b/capplets/background/ChangeLog index 709b3a91e..317501681 100644 --- a/capplets/background/ChangeLog +++ b/capplets/background/ChangeLog @@ -1,3 +1,13 @@ +2004-09-22 Rodney Dawes + + * 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 * gnome-wp-capplet.c: (gnome_wp_icon_theme_changed), diff --git a/capplets/background/gnome-wp-item.c b/capplets/background/gnome-wp-item.c index e8b47891a..61a52cf31 100644 --- a/capplets/background/gnome-wp-item.c +++ b/capplets/background/gnome-wp-item.c @@ -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); diff --git a/capplets/background/gnome-wp-xml.c b/capplets/background/gnome-wp-xml.c index dbd4fe800..4297f3c12 100644 --- a/capplets/background/gnome-wp-xml.c +++ b/capplets/background/gnome-wp-xml.c @@ -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,