diff --git a/src/workspace.c b/src/workspace.c index d58f9046..0fc6e626 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -390,10 +390,8 @@ static void showWorkspaceName(WScreen * scr, int workspace) } ximg = RGetXImage(scr->rcontext, scr->root_win, px, py, data->text->width, data->text->height); - - if (!ximg || !ximg->image) { + if (!ximg) goto erro; - } XMapRaised(dpy, scr->workspace_name); XFlush(dpy); diff --git a/wrlib/xutil.c b/wrlib/xutil.c index 82122d4b..3baa861d 100644 --- a/wrlib/xutil.c +++ b/wrlib/xutil.c @@ -207,7 +207,6 @@ RXImage *RGetXImage(RContext * context, Drawable d, int x, int y, unsigned width ximg->is_shared = 0; ximg->image = XGetImage(context->dpy, d, x, y, width, height, AllPlanes, ZPixmap); } - return ximg; #else /* !USE_XSHM */ ximg = malloc(sizeof(RXImage)); if (!ximg) { @@ -216,9 +215,14 @@ RXImage *RGetXImage(RContext * context, Drawable d, int x, int y, unsigned width } ximg->image = XGetImage(context->dpy, d, x, y, width, height, AllPlanes, ZPixmap); +#endif /* !USE_XSHM */ + + if (ximg->image == NULL) { + free(ximg); + return NULL; + } return ximg; -#endif /* !USE_XSHM */ } void