From 97f6242fcaf937160a964274901ef1f49a2348c6 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Sat, 8 Oct 2005 14:59:45 +0000 Subject: [PATCH] handle shm addr return right SVN revision: 17325 --- legacy/evas/src/lib/engines/xrender_x11/evas_engine_ximage.c | 4 ++-- .../evas/src/lib/engines/xrender_x11/evas_engine_xrender.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/legacy/evas/src/lib/engines/xrender_x11/evas_engine_ximage.c b/legacy/evas/src/lib/engines/xrender_x11/evas_engine_ximage.c index 8e2b149288..4d4591998e 100644 --- a/legacy/evas/src/lib/engines/xrender_x11/evas_engine_ximage.c +++ b/legacy/evas/src/lib/engines/xrender_x11/evas_engine_ximage.c @@ -77,7 +77,7 @@ _xr_image_info_get(Display *disp, Drawable draw, Visual *vis) if (shm_info.shmid >= 0) { shm_info.shmaddr = xim->data = shmat(shm_info.shmid, 0, 0); - if (shm_info.shmaddr != NULL) + if ((shm_info.shmaddr != NULL) && (shm_info.shmaddr != -1)) { XErrorHandler ph; @@ -166,7 +166,7 @@ _xr_image_new(Ximage_Info *xinf, int w, int h, int depth) if (xim->shm_info->shmid >= 0) { xim->shm_info->shmaddr = xim->xim->data = shmat(xim->shm_info->shmid, 0, 0); - if (xim->shm_info->shmaddr != NULL) + if ((xim->shm_info->shmaddr != NULL) && (xim->shm_info->shmaddr != -1)) { XErrorHandler ph; diff --git a/legacy/evas/src/lib/engines/xrender_x11/evas_engine_xrender.c b/legacy/evas/src/lib/engines/xrender_x11/evas_engine_xrender.c index 94618ddb86..cf85b746ce 100644 --- a/legacy/evas/src/lib/engines/xrender_x11/evas_engine_xrender.c +++ b/legacy/evas/src/lib/engines/xrender_x11/evas_engine_xrender.c @@ -21,6 +21,7 @@ _xr_render_surface_new(Ximage_Info *xinf, int w, int h, XRenderPictFormat *fmt, rs->depth = fmt->depth; rs->allocated = 1; rs->draw = XCreatePixmap(xinf->disp, xinf->root, w, h, fmt->depth); + rs->xinf->references++; att.dither = 0; att.component_alpha = 0; att.repeat = 0; @@ -46,6 +47,7 @@ _xr_render_surface_adopt(Ximage_Info *xinf, Drawable draw, int w, int h, int alp if (fmt->depth == 32) rs->alpha = 1; rs->allocated = 0; rs->draw = draw; + rs->xinf->references++; att.dither = 0; att.component_alpha = 0; att.repeat = 0; @@ -67,6 +69,7 @@ _xr_render_surface_format_adopt(Ximage_Info *xinf, Drawable draw, int w, int h, rs->alpha = alpha; rs->depth = fmt->depth; if (fmt->depth == 32) rs->alpha = 1; + rs->xinf->references++; rs->allocated = 0; rs->draw = draw; att.dither = 0; @@ -81,6 +84,8 @@ _xr_render_surface_free(Xrender_Surface *rs) { if (rs->allocated) XFreePixmap(rs->xinf->disp, rs->draw); XRenderFreePicture(rs->xinf->disp, rs->pic); + _xr_image_info_free(rs->xinf); + rs->xinf = NULL; free(rs); }