Fix assertions with side-effects

Fixes #1725
This commit is contained in:
Drew DeVault 2018-04-08 12:49:48 -04:00
parent cedd151e17
commit 7bb8512afb
2 changed files with 12 additions and 7 deletions

View file

@ -431,11 +431,14 @@ int main(int argc, char **argv) {
return 1; return 1;
} }
assert(cursor_theme = wl_cursor_theme_load(NULL, 16, shm)); cursor_theme = wl_cursor_theme_load(NULL, 16, shm);
assert(cursor_theme);
struct wl_cursor *cursor; struct wl_cursor *cursor;
assert(cursor = wl_cursor_theme_get_cursor(cursor_theme, "crosshair")); cursor = wl_cursor_theme_get_cursor(cursor_theme, "crosshair");
assert(cursor);
cursor_image = cursor->images[0]; cursor_image = cursor->images[0];
assert(cursor_surface = wl_compositor_create_surface(compositor)); cursor_surface = wl_compositor_create_surface(compositor)
assert(cursor_surface);
EGLint attribs[] = { EGL_ALPHA_SIZE, 8, EGL_NONE }; EGLint attribs[] = { EGL_ALPHA_SIZE, 8, EGL_NONE };
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display,

View file

@ -28,9 +28,10 @@ static void ready(struct wl_listener *listener, void *data) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
wlr_log_init(L_DEBUG, NULL); wlr_log_init(L_DEBUG, NULL);
assert(server.config = roots_config_create_from_args(argc, argv)); server.config = roots_config_create_from_args(argc, argv);
assert(server.wl_display = wl_display_create()); server.wl_display = wl_display_create();
assert(server.wl_event_loop = wl_display_get_event_loop(server.wl_display)); server.wl_event_loop = wl_display_get_event_loop(server.wl_display)
assert(server.config && server.wl_display && server.wl_event_loop);
server.backend = wlr_backend_autocreate(server.wl_display); server.backend = wlr_backend_autocreate(server.wl_display);
if (server.backend == NULL) { if (server.backend == NULL) {
@ -38,7 +39,8 @@ int main(int argc, char **argv) {
return 1; return 1;
} }
assert(server.renderer = wlr_backend_get_renderer(server.backend)); server.renderer = wlr_backend_get_renderer(server.backend);
assert(server.renderer);
server.data_device_manager = server.data_device_manager =
wlr_data_device_manager_create(server.wl_display); wlr_data_device_manager_create(server.wl_display);
wl_display_init_shm(server.wl_display); wl_display_init_shm(server.wl_display);