backend/x11: prevent segfault on empty DRI3 response

This commit is contained in:
ptrcnull 2022-05-01 06:13:58 +02:00
parent 44069dfd5e
commit 56502be1d1

View file

@ -448,7 +448,8 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
xcb_dri3_query_version(x11->xcb, 1, 2); xcb_dri3_query_version(x11->xcb, 1, 2);
xcb_dri3_query_version_reply_t *dri3_reply = xcb_dri3_query_version_reply_t *dri3_reply =
xcb_dri3_query_version_reply(x11->xcb, dri3_cookie, NULL); xcb_dri3_query_version_reply(x11->xcb, dri3_cookie, NULL);
if (dri3_reply && dri3_reply->major_version >= 1) { if (dri3_reply) {
if (dri3_reply->major_version >= 1) {
x11->have_dri3 = true; x11->have_dri3 = true;
x11->dri3_major_version = dri3_reply->major_version; x11->dri3_major_version = dri3_reply->major_version;
x11->dri3_minor_version = dri3_reply->minor_version; x11->dri3_minor_version = dri3_reply->minor_version;
@ -458,6 +459,9 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
dri3_reply->major_version, dri3_reply->minor_version); dri3_reply->major_version, dri3_reply->minor_version);
} }
free(dri3_reply); free(dri3_reply);
} else {
wlr_log(WLR_INFO, "X11 does not support required DRi3 version");
}
} else { } else {
wlr_log(WLR_INFO, "X11 does not support DRI3 extension"); wlr_log(WLR_INFO, "X11 does not support DRI3 extension");
} }