make destroyed 1 on child widgets too

This commit is contained in:
NishiOwO
2025-12-07 06:34:16 +09:00
parent a0b3ecb697
commit c2e960fe59
2 changed files with 10 additions and 1 deletions

View File

@@ -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;

View File

@@ -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;
}