Fix NULL pointer deref in configure_root

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-03-04 21:37:19 +00:00
parent 7b664de74e
commit 3ab4107fda
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 3 additions and 4 deletions

View File

@ -804,10 +804,9 @@ restack_win(session_t *ps, win *w, xcb_window_t new_above) {
/// Handle configure event of a root window
void configure_root(session_t *ps, int width, int height) {
// On root window changes
auto bi = backend_list[ps->o.backend];
bool has_root_change = ps->backend_data->ops->root_change != NULL;
if (ps->o.experimental_backends) {
assert(bi);
if (!ps->backend_data->ops->root_change) {
if (!has_root_change) {
// deinit/reinit backend if the backend cannot handle root change
ps->backend_data->ops->deinit(ps->backend_data);
ps->backend_data = NULL;
@ -836,7 +835,7 @@ void configure_root(session_t *ps, int width, int height) {
glx_on_root_change(ps);
#endif
if (ps->o.experimental_backends) {
if (ps->backend_data->ops->root_change) {
if (has_root_change) {
ps->backend_data->ops->root_change(ps->backend_data, ps);
} else {
ps->backend_data = backend_list[ps->o.backend](ps);