Fix NULL pointer deref in configure_root
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
7b664de74e
commit
3ab4107fda
|
@ -804,10 +804,9 @@ restack_win(session_t *ps, win *w, xcb_window_t new_above) {
|
||||||
/// Handle configure event of a root window
|
/// Handle configure event of a root window
|
||||||
void configure_root(session_t *ps, int width, int height) {
|
void configure_root(session_t *ps, int width, int height) {
|
||||||
// On root window changes
|
// 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) {
|
if (ps->o.experimental_backends) {
|
||||||
assert(bi);
|
if (!has_root_change) {
|
||||||
if (!ps->backend_data->ops->root_change) {
|
|
||||||
// deinit/reinit backend if the backend cannot handle root change
|
// deinit/reinit backend if the backend cannot handle root change
|
||||||
ps->backend_data->ops->deinit(ps->backend_data);
|
ps->backend_data->ops->deinit(ps->backend_data);
|
||||||
ps->backend_data = NULL;
|
ps->backend_data = NULL;
|
||||||
|
@ -836,7 +835,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) {
|
||||||
if (ps->backend_data->ops->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 {
|
||||||
ps->backend_data = backend_list[ps->o.backend](ps);
|
ps->backend_data = backend_list[ps->o.backend](ps);
|
||||||
|
|
Loading…
Reference in New Issue