Commit 93fc7d71 by Jonah Ryan-Davis Committed by Commit Bot

Add error-handling when getting Xcb window size

We can't trust the reply from Xcb if an error has been flagged. This was causing a crash in SwANGLE. Bug: chromium:1080984 Change-Id: Icaf58197869b563e4193efcf4e70646d519210cf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2209255Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
parent 22aba328
......@@ -39,7 +39,13 @@ angle::Result WindowSurfaceVkXcb::getCurrentWindowSize(vk::Context *context,
{
xcb_get_geometry_cookie_t cookie =
xcb_get_geometry(mXcbConnection, static_cast<xcb_drawable_t>(mNativeWindowType));
xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(mXcbConnection, cookie, nullptr);
xcb_generic_error_t *error = nullptr;
xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(mXcbConnection, cookie, &error);
if (error)
{
free(error);
ANGLE_VK_CHECK(context, false, VK_ERROR_INITIALIZATION_FAILED);
}
ASSERT(reply);
*extentsOut = gl::Extents(reply->width, reply->height, 1);
free(reply);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment