From 4cb88fdc05e74ddb3f1a4032dca53fcf64634bb7 Mon Sep 17 00:00:00 2001 From: IoIxD Date: Mon, 21 Sep 2026 11:40:51 -0700 Subject: [PATCH] wayland: remove our widget from parent's currently held widgets on destroy --- src/backend/wayland/wayland.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/backend/wayland/wayland.c b/src/backend/wayland/wayland.c index c854453..d534518 100644 --- a/src/backend/wayland/wayland.c +++ b/src/backend/wayland/wayland.c @@ -986,6 +986,9 @@ static void MwLLDestroyImpl(MwLL handle) { int i; struct timeval tv; int select_ret; + MwLL topmost_parent = handle; + + while(topmost_parent->wayland.parent) topmost_parent = topmost_parent->wayland.parent; event_loop(handle); // wl_display_cancel_read(handle->wayland.display); @@ -1025,6 +1028,12 @@ static void MwLLDestroyImpl(MwLL handle) { printf("widget invalid\n"); } + for(i = 0; i < arrlen(topmost_parent->wayland.currentlyHeldWidgets); i++) { + if(topmost_parent->wayland.currentlyHeldWidgets[i] == handle) { + arrdel(topmost_parent->wayland.currentlyHeldWidgets, i); + } + } + // pthread_mutex_destroy(&handle->wayland.eventsMutex); free(handle);