From 57dd0fdcf6cb1885b430f2c2361b2d98cbe5f552 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Fri, 21 Nov 2025 23:34:20 +0000 Subject: [PATCH] fix double free git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@772 b9cfdab3-6d41-4d17-bbe4-086880011989 --- src/core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index fbc177e..074145e 100644 --- a/src/core.c +++ b/src/core.c @@ -237,7 +237,13 @@ static void MwFreeWidget(MwWidget handle) { void MwDestroyWidget(MwWidget handle) { if(handle->parent != NULL) { - arrput(handle->parent->destroy_queue, handle); + int i; + for(i = 0; i < arrlen(handle->parent->destroy_queue); i++){ + if(handle->parent->destroy_queue[i] == handle) break; + } + if(i == arrlen(handle->parent->destroy_queue)){ + arrput(handle->parent->destroy_queue, handle); + } } handle->destroyed = 1; }