From c2e960fe5956da44fe5a188f52b27a847ae38612 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Sun, 7 Dec 2025 06:34:16 +0900 Subject: [PATCH] make destroyed 1 on child widgets too --- Makefile.pl | 2 +- src/core.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile.pl b/Makefile.pl index b006c7b..fe5349c 100755 --- a/Makefile.pl +++ b/Makefile.pl @@ -210,7 +210,7 @@ if (param_get("static")) { } foreach my $l (@library_targets) { - my $warn = "-Wall -Wextra -Wno-sign-compare"; + my $warn = "-Wall -Wextra -Wno-sign-compare -Wno-unused-value"; my $s = $l; my $o = $object_suffix; $o =~ s/\./\\\./g; diff --git a/src/core.c b/src/core.c index 00479ff..669b181 100644 --- a/src/core.c +++ b/src/core.c @@ -238,6 +238,14 @@ static void MwFreeWidget(MwWidget handle) { free(handle); } +static void destroy_children(MwWidget handle) { + int i; + for(i = 0; i < arrlen(handle->children); i++) { + destroy_children(handle->children[i]); + } + handle->destroyed = 1; +} + void MwDestroyWidget(MwWidget handle) { if(handle->parent != NULL) { int i; @@ -248,6 +256,7 @@ void MwDestroyWidget(MwWidget handle) { arrput(handle->parent->destroy_queue, handle); } } + destroy_children(handle); handle->destroyed = 1; }