summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2022-11-07 11:57:51 +0100
committerLuke from DC <[email protected]>2022-11-09 05:16:55 +0000
commit7b379f54a5b09df007f7e84dabbbc5f8ce9381a9 (patch)
treee4eced31913bffb8ea01f70dfb86aacbf8a304b6
parent354058cc0370a770bb2cfe46d6e6082035d3f909 (diff)
downloadmate-desktop-7b379f54a5b09df007f7e84dabbbc5f8ce9381a9.tar.bz2
mate-desktop-7b379f54a5b09df007f7e84dabbbc5f8ce9381a9.tar.xz
Revert "[mate-bg] small cleanup"
It is not possible to use the `list` pointer after it has been deleted, so the "cleanup" this commit made lead to using freed memory if any item actually got clean up. This "cleanup" also don't seem meaningful to me, as all it does otherwise is trade an assignation for a redundant test -- either of which the compiler might happily optimize out. This reverts commit 47426c90d10e9f738ecf89f35db94ca8deff55e0.
-rw-r--r--libmate-desktop/mate-bg.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index 0f617fa..e535231 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -2002,19 +2002,18 @@ static gboolean
blow_expensive_caches (gpointer data)
{
MateBG *bg = data;
- GList *list;
+ GList *list, *next;
bg->blow_caches_id = 0;
- if (bg->file_cache) {
- for (list = bg->file_cache; list != NULL; list = list->next) {
- FileCacheEntry *ent = list->data;
+ for (list = bg->file_cache; list != NULL; list = next) {
+ FileCacheEntry *ent = list->data;
+ next = list->next;
- if (ent->type == PIXBUF) {
- file_cache_entry_delete (ent);
- bg->file_cache = g_list_delete_link (bg->file_cache,
- list);
- }
+ if (ent->type == PIXBUF) {
+ file_cache_entry_delete (ent);
+ bg->file_cache = g_list_delete_link (bg->file_cache,
+ list);
}
}