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 Michael Stapelberg
parent 551d0a5b13
commit 68904aeb38

View File

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