Merge pull request #2096 from Airblader/bug-2094

Fix draw_util crash
This commit is contained in:
Michael Stapelberg 2015-12-04 09:01:26 +01:00
commit fcef1c8ea1
2 changed files with 3 additions and 4 deletions

View File

@ -47,8 +47,7 @@ void draw_util_surface_init(xcb_connection_t *conn, surface_t *surface, xcb_draw
xcb_generic_error_t *error = xcb_request_check(conn, gc_cookie); xcb_generic_error_t *error = xcb_request_check(conn, gc_cookie);
if (error != NULL) { if (error != NULL) {
ELOG("Could not create graphical context. Error code: %d\n", error->error_code); ELOG("Could not create graphical context. Error code: %d. Please report this bug.\n", error->error_code);
exit(EXIT_FAILURE);
} }
#ifdef CAIRO_SUPPORT #ifdef CAIRO_SUPPORT

View File

@ -783,8 +783,8 @@ void x_push_node(Con *con) {
/* Ensure we have valid dimensions for our surface. */ /* Ensure we have valid dimensions for our surface. */
// TODO This is probably a bug in the condition above as we should never enter this path // TODO This is probably a bug in the condition above as we should never enter this path
// for height == 0. Also, we should probably handle width == 0 the same way. // for height == 0. Also, we should probably handle width == 0 the same way.
int width = MAX(rect.width, 1); int width = MAX((int32_t)rect.width, 1);
int height = MAX(rect.height, 1); int height = MAX((int32_t)rect.height, 1);
xcb_create_pixmap_checked(conn, win_depth, con->frame_buffer.id, con->frame.id, width, height); xcb_create_pixmap_checked(conn, win_depth, con->frame_buffer.id, con->frame.id, width, height);
draw_util_surface_init(conn, &(con->frame_buffer), con->frame_buffer.id, draw_util_surface_init(conn, &(con->frame_buffer), con->frame_buffer.id,