mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 01:41:30 +00:00
swaynag: sway_abort on failure to properly register
In case `wl_display_roundtrip` returns an error after registering for events, print a more user-friendly error message and exit. Previously, if the build did not have assertions enabled, this would likely result in a segfault. With assertions enabled, it's not user friendly to terminate with internal implementation information.
This commit is contained in:
parent
ed08f2f20c
commit
62a530513c
|
@ -445,7 +445,10 @@ void swaynag_setup(struct swaynag *swaynag) {
|
||||||
|
|
||||||
struct wl_registry *registry = wl_display_get_registry(swaynag->display);
|
struct wl_registry *registry = wl_display_get_registry(swaynag->display);
|
||||||
wl_registry_add_listener(registry, ®istry_listener, swaynag);
|
wl_registry_add_listener(registry, ®istry_listener, swaynag);
|
||||||
wl_display_roundtrip(swaynag->display);
|
if (wl_display_roundtrip(swaynag->display) < 0) {
|
||||||
|
sway_abort("failed to register with the wayland display");
|
||||||
|
}
|
||||||
|
|
||||||
assert(swaynag->compositor && swaynag->layer_shell && swaynag->shm);
|
assert(swaynag->compositor && swaynag->layer_shell && swaynag->shm);
|
||||||
|
|
||||||
while (swaynag->querying_outputs > 0) {
|
while (swaynag->querying_outputs > 0) {
|
||||||
|
|
Loading…
Reference in a new issue