mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-20 17:35:39 +02:00
misc: xcb_connect() always returns a non-NULL pointer
Instead, we need to check if xcb_connection_has_error() says something went wrong. We also need to call xcb_disconnect() on the disfunctional XCB connection object.
This commit is contained in:
parent
406d6b3b83
commit
9d5bbe0566
5 changed files with 29 additions and 11 deletions
9
bar.c
9
bar.c
|
@ -324,8 +324,13 @@ run(struct bar *_bar)
|
|||
/* TODO: a lot of this (up to mapping the window) could be done in bar_new() */
|
||||
xcb_generic_error_t *e;
|
||||
|
||||
bar->conn = xcb_connect(NULL, NULL);
|
||||
assert(bar->conn != NULL);
|
||||
int default_screen;
|
||||
bar->conn = xcb_connect(NULL, &default_screen);
|
||||
if (xcb_connection_has_error(bar->conn) > 0) {
|
||||
LOG_ERR("failed to connect to X");
|
||||
xcb_disconnect(bar->conn);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const xcb_setup_t *setup = xcb_get_setup(bar->conn);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue