summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-09-21 21:07:40 +0000
committerAylur <[email protected]>2024-09-21 21:07:40 +0000
commitf3762b9cc8e20620a058b1c46c478a9270295455 (patch)
tree0abe7222b39e2f2268cb07eacf8338b5c1b7809f
parentad8d3409fec4d7d4fd728f364a139947ff1185e3 (diff)
fix(box): children setter
do not call destroy on an already removed child
-rw-r--r--core/src/widget/box.vala7
-rw-r--r--core/src/widget/stack.vala7
2 files changed, 8 insertions, 6 deletions
diff --git a/core/src/widget/box.vala b/core/src/widget/box.vala
index 0e069e0..0008fd4 100644
--- a/core/src/widget/box.vala
+++ b/core/src/widget/box.vala
@@ -42,10 +42,11 @@ public class Box : Gtk.Box {
private void _set_children(List<weak Gtk.Widget> arr) {
foreach(var child in get_children()) {
- remove(child);
-
- if (!no_implicit_destroy && arr.find(child).length() == 0)
+ if (!no_implicit_destroy && arr.find(child).length() == 0) {
child.destroy();
+ } else {
+ remove(child);
+ }
}
foreach(var child in arr)
diff --git a/core/src/widget/stack.vala b/core/src/widget/stack.vala
index 020e716..00adf7f 100644
--- a/core/src/widget/stack.vala
+++ b/core/src/widget/stack.vala
@@ -16,10 +16,11 @@ public class Astal.Stack : Gtk.Stack {
private void _set_children(List<weak Gtk.Widget> arr) {
foreach(var child in get_children()) {
- remove(child);
-
- if (!no_implicit_destroy && arr.find(child).length() == 0)
+ if (!no_implicit_destroy && arr.find(child).length() == 0) {
child.destroy();
+ } else {
+ remove(child);
+ }
}
var i = 0;