Init eventloop directly after wl_connect

this makes sure the eventloop is initialized before
any event dispatching. fixes occasional segfaults I
observed on resume.
This commit is contained in:
Christian Meissl 2024-02-16 21:26:35 +01:00 committed by Simon Ser
parent b63aaffcd1
commit 376cc5fcd4

2
main.c
View File

@ -1205,6 +1205,7 @@ int main(int argc, char **argv) {
"WAYLAND_DISPLAY environment variable."); "WAYLAND_DISPLAY environment variable.");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
state.eventloop = loop_create();
struct wl_registry *registry = wl_display_get_registry(state.display); struct wl_registry *registry = wl_display_get_registry(state.display);
wl_registry_add_listener(registry, &registry_listener, &state); wl_registry_add_listener(registry, &registry_listener, &state);
@ -1269,7 +1270,6 @@ int main(int argc, char **argv) {
daemonize(); daemonize();
} }
state.eventloop = loop_create();
loop_add_fd(state.eventloop, wl_display_get_fd(state.display), POLLIN, loop_add_fd(state.eventloop, wl_display_get_fd(state.display), POLLIN,
display_in, NULL); display_in, NULL);