make destroyed 1 on child widgets too

This commit is contained in:
Nishi 2025-12-07 06:34:16 +09:00
commit c2e960fe59
Signed by: nishi
GPG key ID: 27EF69B208EB9343
2 changed files with 10 additions and 1 deletions

View file

@ -210,7 +210,7 @@ if (param_get("static")) {
} }
foreach my $l (@library_targets) { 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 $s = $l;
my $o = $object_suffix; my $o = $object_suffix;
$o =~ s/\./\\\./g; $o =~ s/\./\\\./g;

View file

@ -238,6 +238,14 @@ static void MwFreeWidget(MwWidget handle) {
free(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) { void MwDestroyWidget(MwWidget handle) {
if(handle->parent != NULL) { if(handle->parent != NULL) {
int i; int i;
@ -248,6 +256,7 @@ void MwDestroyWidget(MwWidget handle) {
arrput(handle->parent->destroy_queue, handle); arrput(handle->parent->destroy_queue, handle);
} }
} }
destroy_children(handle);
handle->destroyed = 1; handle->destroyed = 1;
} }