From 675d28dd545aff901a11fcfabe448369f408a4ce Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 24 Jun 2009 19:22:09 +0200 Subject: [PATCH] Bugfix: Check screen for NULL, free client memory correctly (Thanks dirkson) --- src/handlers.c | 5 ++--- src/layout.c | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/handlers.c b/src/handlers.c index ae1a5d7f..3930e1e7 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -578,9 +578,6 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti client = table_remove(&by_child, event->window); - if (client->name != NULL) - free(client->name); - /* Clients without a container are either floating or dock windows */ if (client->container != NULL) { Container *con = client->container; @@ -644,6 +641,8 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti client->workspace->screen = NULL; } + FREE(client->window_class); + FREE(client->name); free(client); render_layout(conn); diff --git a/src/layout.c b/src/layout.c index e70d0f49..4f132aea 100644 --- a/src/layout.c +++ b/src/layout.c @@ -188,6 +188,11 @@ void reposition_client(xcb_connection_t *conn, Client *client) { if (client->workspace->screen == (screen = get_screen_containing(client->rect.x, client->rect.y))) return; + if (screen == NULL) { + LOG("Boundary checking disabled, no screen found for (%d, %d)\n", client->rect.x, client->rect.y); + return; + } + LOG("Client is on workspace %p with screen %p\n", client->workspace, client->workspace->screen); LOG("but screen at %d, %d is %p\n", client->rect.x, client->rect.y, screen); floating_assign_to_workspace(client, &workspaces[screen->current_workspace]); -- 2.39.5