From cf503d67a24e331cf531a8158fecdc3d342b91bc Mon Sep 17 00:00:00 2001 From: migueldeoleiros Date: Wed, 30 Oct 2024 23:14:43 +0100 Subject: [PATCH] fix: properly delete toplevel on unmap --- src/toplevel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/toplevel.c b/src/toplevel.c index 73a97ed..e05423f 100644 --- a/src/toplevel.c +++ b/src/toplevel.c @@ -23,6 +23,7 @@ #include "toplevel.h" #include "src/server.h" #include "src/workspace.h" +#include "wlr/util/log.h" #include #include #include @@ -134,7 +135,7 @@ void xdg_toplevel_unmap(struct wl_listener *listener, void *data) { /* Called when the surface is unmapped, and should no longer be shown. */ struct turtile_toplevel *toplevel = wl_container_of(listener, toplevel, unmap); - /* Reset the cursor mode if the grabbed toplevel was unmapped. */ + /* Reset the cursor mode and focus if the grabbed toplevel was unmapped. */ if (toplevel == toplevel->server->grabbed_toplevel) { reset_cursor_mode(toplevel->server); @@ -143,6 +144,7 @@ void xdg_toplevel_unmap(struct wl_listener *listener, void *data) { } wl_list_remove(&toplevel->link); + wl_list_remove(&toplevel->flink); } void xdg_toplevel_commit(struct wl_listener *listener, void *data) {