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
     1.1 --- a/src/core.c	Mon Oct 30 17:40:34 2023 +0100
     1.2 +++ b/src/core.c	Mon Oct 30 17:59:37 2023 +0100
     1.3 @@ -266,14 +266,15 @@
     1.4  
     1.5  void asc_window_destroy(AscWindow* window) {
     1.6      // find the window in the context and remove it
     1.7 +    bool found = false;
     1.8      CxMutIterator iter = cxListMutIterator(asc_context.windows);
     1.9      cx_foreach(AscWindow*, w, iter) {
    1.10          if (w == window) {
    1.11 -            asc_dprintf("Window %u removed from context.", window->id);
    1.12 +            found = true;
    1.13              cxIteratorFlagRemoval(iter);
    1.14          }
    1.15      }
    1.16 -    asc_window_destroy_impl(window);
    1.17 +    if (!found) asc_window_destroy_impl(window);
    1.18  }
    1.19  
    1.20  void asc_window_sync(AscWindow const* window) {

mercurial