Merge pull request #1403 from admshao/gl-improve-error-handling

Improve X error handling
master
Jim 2018-08-02 23:53:34 -07:00 committed by GitHub
commit be44b36bd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions

View File

@ -323,10 +323,16 @@ error:
static int x_error_handler(Display *display, XErrorEvent *error)
{
char str[512];
XGetErrorText(display, error->error_code, str, sizeof(str));
char str1[512];
char str2[512];
char str3[512];
XGetErrorText(display, error->error_code, str1, sizeof(str1));
XGetErrorText(display, error->request_code, str2, sizeof(str2));
XGetErrorText(display, error->minor_code, str3, sizeof(str3));
blog(LOG_ERROR, "X Error: %s", str);
blog(LOG_ERROR, "X Error: %s, Major opcode: %s, "
"Minor opcode: %s, Serial: %lu",
str1, str2, str3, error->serial);
return 0;
}
@ -514,8 +520,10 @@ extern void gl_getclientsize(const struct gs_swap_chain *swap,
xcb_window_t window = swap->wi->window;
xcb_get_geometry_reply_t *geometry = get_window_geometry(xcb_conn, window);
*width = geometry->width;
*height = geometry->height;
if (geometry) {
*width = geometry->width;
*height = geometry->height;
}
free(geometry);
}