diff options
author | emersion <contact@emersion.fr> | 2017-11-02 17:21:00 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-11-02 17:21:00 +0100 |
commit | 900fb326f7608695a160a2ce645db94f33df7f87 (patch) | |
tree | d34cd718de3cbb292b752750b6e06561d73cdfe9 /xwayland | |
parent | bb76f5264080be36138ec7c3e4dc3d83ed37d858 (diff) |
Fixes segfault when no xcb_render_pictforminfo_t is available
Diffstat (limited to 'xwayland')
-rw-r--r-- | xwayland/xwm.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 9b75879e..f011587e 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -1193,17 +1193,18 @@ static void xwm_get_render_format(struct wlr_xwm *xwm) { xcb_render_query_pict_formats(xwm->xcb_conn); xcb_render_query_pict_formats_reply_t *reply = xcb_render_query_pict_formats_reply(xwm->xcb_conn, cookie, NULL); - xcb_render_pictforminfo_t *formats = - xcb_render_query_pict_formats_formats(reply); - int len = xcb_render_query_pict_formats_formats_length(reply); + xcb_render_pictforminfo_iterator_t iter = + xcb_render_query_pict_formats_formats_iterator(reply); xcb_render_pictforminfo_t *format = NULL; - for (int i = 0; i < len; ++i) { - if (formats[i].depth == 32) { - format = &formats[i]; + while (iter.rem > 0) { + if (iter.data->depth == 32) { + format = iter.data; break; } - // TODO: segfaults when not found + + xcb_render_pictforminfo_next(&iter); } + if (format == NULL) { wlr_log(L_DEBUG, "No 32 bit render format"); return; |