i3-companion: avoid leaking X11 file descriptor

This commit is contained in:
Vincent Bernat 2021-07-15 21:26:54 +02:00
parent ae6e89e27e
commit e79b7291ad

View file

@ -517,6 +517,7 @@ async def output_update(i3, event):
# Grab current setup. Synchronous, but it's short enough # Grab current setup. Synchronous, but it's short enough
d = display.Display() d = display.Display()
try:
screen = d.screen() screen = d.screen()
window = screen.root.create_window(0, 0, 1, 1, 1, screen.root_depth) window = screen.root.create_window(0, 0, 1, 1, 1, screen.root_depth)
screen_resources = randr.get_screen_resources_current(window) screen_resources = randr.get_screen_resources_current(window)
@ -539,6 +540,8 @@ async def output_update(i3, event):
crtc_info.y, crtc_info.y,
) )
) )
finally:
d.close()
# Compare to current setup # Compare to current setup
if current_setup == output_update.last_setup: if current_setup == output_update.last_setup: