pipewire: module-x11-bell: remove a function

`x11_close()` is no longer needed since X11 errors
are now considered fatal, so `module_destroy()` will
be called if `x11_connect()` fails, which means that
the code from `x11_close()` can be moved there.
This commit is contained in:
Barnabás Pőcze 2022-02-17 02:38:06 +01:00
parent ffabf78cb7
commit d558e87b51

View file

@ -154,18 +154,6 @@ static void display_io(void *data, int fd, uint32_t mask)
} }
} }
static void x11_close(struct impl *impl)
{
if (impl->source) {
pw_loop_destroy_source(impl->loop, impl->source);
impl->source = NULL;
}
if (impl->display) {
XCloseDisplay(impl->display);
impl->display = NULL;
}
}
static int x11_connect(struct impl *impl, const char *name) static int x11_connect(struct impl *impl, const char *name)
{ {
int res, major, minor; int res, major, minor;
@ -209,8 +197,6 @@ static int x11_connect(struct impl *impl, const char *name)
res = 0; res = 0;
error: error:
if (res < 0)
x11_close(impl);
return res; return res;
} }
@ -221,7 +207,11 @@ static void module_destroy(void *data)
if (impl->module) if (impl->module)
spa_hook_remove(&impl->module_listener); spa_hook_remove(&impl->module_listener);
x11_close(impl); if (impl->source)
pw_loop_destroy_source(impl->loop, impl->source);
if (impl->display)
XCloseDisplay(impl->display);
if (impl->thread_loop) if (impl->thread_loop)
pw_thread_loop_destroy(impl->thread_loop); pw_thread_loop_destroy(impl->thread_loop);