From 161ccc282ff8d7c89cbcf899ca1add166e9dabd5 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 4 Mar 2023 02:23:37 +0900 Subject: [PATCH] [ruamoko] Unlink passage nodes when deleting Fixes a segfault on shutdown after the memory leak changes. --- libs/ruamoko/rua_gui.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/ruamoko/rua_gui.c b/libs/ruamoko/rua_gui.c index 3b404071b..8bd59ad46 100644 --- a/libs/ruamoko/rua_gui.c +++ b/libs/ruamoko/rua_gui.c @@ -84,6 +84,10 @@ passage_new (gui_resources_t *res) static void passage_free (gui_resources_t *res, rua_passage_t *passage) { + if (passage->next) { + passage->next->prev = passage->prev; + } + *passage->prev = passage->next; PR_RESFREE (res->passage_map, passage); } @@ -192,8 +196,7 @@ bi_gui_clear (progs_t *pr, void *_res) { gui_resources_t *res = _res; - rua_passage_t *psg; - for (psg = res->passages; psg; psg = psg->next) { + for (rua_passage_t *psg = res->passages; psg; psg = psg->next) { Passage_Delete (psg->passage); } res->passages = 0;