Fix i3bar Xorg memory leak (#4140)

The `*_free_*` calls in this branch:
51b0583578/i3bar/src/xcb.c (L1854)
are never called when we remove the output from the tailq during a
refresh.

Fixes #4123
This commit is contained in:
Orestis Floros 2020-06-27 00:10:53 +02:00 committed by GitHub
parent 51b0583578
commit 025743eaf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -45,3 +45,4 @@ working. Please reach out to us in that case!
• set _NET_DESKTOP_VIEWPORT after randr changes • set _NET_DESKTOP_VIEWPORT after randr changes
• fix a bug with i3-nagbar not starting after it has already started once • fix a bug with i3-nagbar not starting after it has already started once
• fix conflict when moving parent of fullscreen window to workspace • fix conflict when moving parent of fullscreen window to workspace
• fix Xorg memory leak with i3bar

View File

@ -1609,16 +1609,19 @@ void kick_tray_clients(i3_output *output) {
* *
*/ */
void destroy_window(i3_output *output) { void destroy_window(i3_output *output) {
if (output == NULL) { if (output == NULL || output->bar.id == XCB_NONE) {
return;
}
if (output->bar.id == XCB_NONE) {
return; return;
} }
kick_tray_clients(output); draw_util_surface_free(xcb_connection, &(output->bar));
draw_util_surface_free(xcb_connection, &(output->buffer));
draw_util_surface_free(xcb_connection, &(output->statusline_buffer));
xcb_destroy_window(xcb_connection, output->bar.id); xcb_destroy_window(xcb_connection, output->bar.id);
xcb_free_pixmap(xcb_connection, output->buffer.id);
xcb_free_pixmap(xcb_connection, output->statusline_buffer.id);
output->bar.id = XCB_NONE; output->bar.id = XCB_NONE;
kick_tray_clients(output);
} }
/* Strut partial tells i3 where to reserve space for i3bar. This is determined /* Strut partial tells i3 where to reserve space for i3bar. This is determined