Skip to content

Commit

Permalink
core: check experimental_backend before accessing backend_list
Browse files Browse the repository at this point in the history
backend_list[backend] is only guaranteed to be non-NULL if experimental
backends are used.

Fixes chjj#258

Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Nov 10, 2019
1 parent 44a771c commit 30e9e2d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1161,9 +1161,15 @@ xcb_window_t session_get_target_window(session_t *ps) {
}

static inline uint8_t session_redirection_mode(session_t *ps) {
if (ps->o.debug_mode || !backend_list[ps->o.backend]->present) {
// If the backend is not rendering to the screen, or if the backend
// doesn't render anything, we don't need to take over the screen.
if (ps->o.debug_mode) {
// If the backend is not rendering to the screen, we don't need to
// take over the screen.
assert(ps->o.experimental_backends);
return XCB_COMPOSITE_REDIRECT_AUTOMATIC;
}
if (ps->o.experimental_backends && !backend_list[ps->o.backend]->present) {
// if the backend doesn't render anything, we don't need to take over the
// screen.
return XCB_COMPOSITE_REDIRECT_AUTOMATIC;
}
return XCB_COMPOSITE_REDIRECT_MANUAL;
Expand Down

0 comments on commit 30e9e2d

Please sign in to comment.