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 <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-03-24 15:40:37 +00:00
parent f501d35ba9
commit b5b9419ecc
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 7 additions and 2 deletions

View File

@ -749,6 +749,7 @@ static void destroy_backend(session_t *ps) {
/// Init the backend and bind all the window pixmap to backend images /// Init the backend and bind all the window pixmap to backend images
static bool initialize_backend(session_t *ps) { static bool initialize_backend(session_t *ps) {
if (ps->o.experimental_backends) { if (ps->o.experimental_backends) {
assert(!ps->backend_data);
// Reinitialize win_data // Reinitialize win_data
ps->backend_data = backend_list[ps->o.backend]->init(ps); ps->backend_data = backend_list[ps->o.backend]->init(ps);
ps->backend_data->ops = backend_list[ps->o.backend]; 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); log_info("Root configuration changed, new geometry: %dx%d", width, height);
// On root window changes // On root window changes
bool has_root_change = false; 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; has_root_change = ps->backend_data->ops->root_change != NULL;
if (!has_root_change) { if (!has_root_change) {
// deinit/reinit backend and free up resources if the backend // 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); glx_on_root_change(ps);
} }
#endif #endif
if (ps->o.experimental_backends) { if (ps->o.experimental_backends && ps->redirected) {
if (has_root_change) { if (has_root_change) {
ps->backend_data->ops->root_change(ps->backend_data, ps); ps->backend_data->ops->root_change(ps->backend_data, ps);
} else { } else {
@ -909,6 +910,10 @@ void root_damaged(session_t *ps) {
free_root_tile(ps); free_root_tile(ps);
} }
if (!ps->redirected) {
return;
}
if (ps->o.experimental_backends) { if (ps->o.experimental_backends) {
if (ps->root_image) { if (ps->root_image) {
ps->backend_data->ops->release_image(ps->backend_data, ps->root_image); ps->backend_data->ops->release_image(ps->backend_data, ps->root_image);