From: Michael Stapelberg Date: Wed, 24 Jun 2009 17:22:09 +0000 (+0200) Subject: Bugfix: Check screen for NULL, free client memory correctly (Thanks dirkson) X-Git-Tag: 3.b~18 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=675d28dd545aff901a11fcfabe448369f408a4ce;p=i3%2Fi3 Bugfix: Check screen for NULL, free client memory correctly (Thanks dirkson) --- 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]);