Fix new backend related crash

Use of invalid backend_info_t.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-02-21 03:50:34 +00:00
parent a7f373dec3
commit d145808e69
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
2 changed files with 9 additions and 8 deletions

View File

@ -802,12 +802,13 @@ restack_win(session_t *ps, win *w, xcb_window_t new_above) {
void
configure_win(session_t *ps, xcb_configure_notify_event_t *ce) {
// On root window changes
auto root_change_fn = backend_list[ps->o.backend]->root_change;
auto bi = backend_list[ps->o.backend];
if (ce->window == ps->root) {
if (ps->o.experimental_backends) {
if (!root_change_fn) {
assert(bi);
if (!bi->root_change) {
// deinit/reinit backend if the backend cannot handle root change
backend_list[ps->o.backend]->deinit(ps->backend_data, ps);
bi->deinit(ps->backend_data, ps);
ps->backend_data = NULL;
}
} else {
@ -848,10 +849,10 @@ configure_win(session_t *ps, xcb_configure_notify_event_t *ce) {
glx_on_root_change(ps);
#endif
if (ps->o.experimental_backends) {
if (root_change_fn) {
root_change_fn(ps->backend_data, ps);
if (bi->root_change) {
bi->root_change(ps->backend_data, ps);
} else {
ps->backend_data = backend_list[ps->o.backend]->init(ps);
ps->backend_data = bi->init(ps);
}
}
force_repaint(ps);

View File

@ -292,13 +292,13 @@ static inline attr_const enum backend parse_backend(const char *str) {
}
// Keep compatibility with an old revision containing a spelling mistake...
if (!strcasecmp(str, "xr_glx_hybird")) {
log_warn("backend xr_glx_hybird should be xr_glx_hybrid, the misspelt"
log_warn("backend xr_glx_hybird should be xr_glx_hybrid, the misspelt "
"version will be removed soon.");
return BKEND_XR_GLX_HYBRID;
}
// cju wants to use dashes
if (!strcasecmp(str, "xr-glx-hybrid")) {
log_warn("backend xr-glx-hybrid should be xr_glx_hybrid, the alternative"
log_warn("backend xr-glx-hybrid should be xr_glx_hybrid, the alternative "
"version will be removed soon.");
return BKEND_XR_GLX_HYBRID;
}