fix possible double-invocation of asc_window_destroy_impl()

Mon, 30 Oct 2023 17:59:37 +0100

author
Mike Becker <universe@uap-core.de>
date
Mon, 30 Oct 2023 17:59:37 +0100
changeset 2
bb2bfff31f1d
parent 1
e3113d4e2fc0
child 3
1efd6da2ad53

fix possible double-invocation of asc_window_destroy_impl()

src/core.c file | annotate | diff | comparison | revisions
--- a/src/core.c	Mon Oct 30 17:40:34 2023 +0100
+++ b/src/core.c	Mon Oct 30 17:59:37 2023 +0100
@@ -266,14 +266,15 @@
 
 void asc_window_destroy(AscWindow* window) {
     // find the window in the context and remove it
+    bool found = false;
     CxMutIterator iter = cxListMutIterator(asc_context.windows);
     cx_foreach(AscWindow*, w, iter) {
         if (w == window) {
-            asc_dprintf("Window %u removed from context.", window->id);
+            found = true;
             cxIteratorFlagRemoval(iter);
         }
     }
-    asc_window_destroy_impl(window);
+    if (!found) asc_window_destroy_impl(window);
 }
 
 void asc_window_sync(AscWindow const* window) {

mercurial