From 615a3b43fc9470c8479ef5213bd96c509404fb86 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 24 Mar 2019 15:40:37 +0000 Subject: [PATCH] core: don't rebind root image when unredirected When the screen is not redirected, don't update the root image because the backend is not initialized in this case. Fixes a crash. Signed-off-by: Yuxuan Shui --- src/compton.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compton.c b/src/compton.c index af4ad38b..684e40e6 100644 --- a/src/compton.c +++ b/src/compton.c @@ -749,6 +749,7 @@ static void destroy_backend(session_t *ps) { /// Init the backend and bind all the window pixmap to backend images static bool initialize_backend(session_t *ps) { if (ps->o.experimental_backends) { + assert(!ps->backend_data); // Reinitialize win_data ps->backend_data = backend_list[ps->o.backend]->init(ps); ps->backend_data->ops = backend_list[ps->o.backend]; @@ -777,7 +778,7 @@ void configure_root(session_t *ps, int width, int height) { log_info("Root configuration changed, new geometry: %dx%d", width, height); // On root window changes bool has_root_change = false; - if (ps->o.experimental_backends) { + if (ps->o.experimental_backends && ps->redirected) { has_root_change = ps->backend_data->ops->root_change != NULL; if (!has_root_change) { // deinit/reinit backend and free up resources if the backend @@ -808,7 +809,7 @@ void configure_root(session_t *ps, int width, int height) { glx_on_root_change(ps); } #endif - if (ps->o.experimental_backends) { + if (ps->o.experimental_backends && ps->redirected) { if (has_root_change) { ps->backend_data->ops->root_change(ps->backend_data, ps); } else { @@ -909,6 +910,10 @@ void root_damaged(session_t *ps) { free_root_tile(ps); } + if (!ps->redirected) { + return; + } + if (ps->o.experimental_backends) { if (ps->root_image) { ps->backend_data->ops->release_image(ps->backend_data, ps->root_image);