From: raster Date: Wed, 6 Jan 2010 15:21:01 +0000 (+0000) Subject: fix shm leak X-Git-Tag: accepted/2.0/20130306.224007~195^2~1227 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d8d6110ae59fc4524905dcd745788a02d4794972;p=profile%2Fivi%2Fecore.git fix shm leak git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@44925 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/ecore_x/xlib/ecore_x_image.c b/src/lib/ecore_x/xlib/ecore_x_image.c index 2efa274..db5d83b 100644 --- a/src/lib/ecore_x/xlib/ecore_x_image.c +++ b/src/lib/ecore_x/xlib/ecore_x_image.c @@ -78,6 +78,7 @@ _ecore_x_image_shm_check(void) XSetErrorHandler((XErrorHandler)ph); if (_ecore_x_image_err) { + XShmDetach(_ecore_x_disp, &shminfo); shmdt(shminfo.shmaddr); shmctl(shminfo.shmid, IPC_RMID, 0); XDestroyImage(xim); @@ -85,6 +86,7 @@ _ecore_x_image_shm_check(void) return; } + XShmDetach(_ecore_x_disp, &shminfo); shmdt(shminfo.shmaddr); shmctl(shminfo.shmid, IPC_RMID, 0); XDestroyImage(xim); @@ -120,35 +122,13 @@ ecore_x_image_new(int w, int h, Ecore_X_Visual vis, int depth) return im; } -/* - if (_ecore_x_image_shm_can) - { - } - else - { - im->xim = XCreateImage(_ecore_x_disp, im->vis, im->depth, - ZPixmap, 0, NULL, im->w, im->h, 32, 0); - if (!im->xim) - { - free(im); - return NULL; - } - im->xim->data = malloc(im->xim->bytes_per_line * im->xim->height); - if (im->xim->data == NULL) - { - XDestroyImage(im->xim); - free(im); - return NULL; - } - } - im->data = im->xim->data; -*/ - EAPI void ecore_x_image_free(Ecore_X_Image *im) { + printf("%p: shm--\n", im); if (im->shm) { + XShmDetach(_ecore_x_disp, &(im->shminfo)); shmdt(im->shminfo.shmaddr); shmctl(im->shminfo.shmid, IPC_RMID, 0); } @@ -200,6 +180,7 @@ _ecore_x_image_shm_create(Ecore_X_Image *im) if (im->xim->bits_per_pixel <= 8) im->bpp = 1; else if (im->xim->bits_per_pixel <= 16) im->bpp = 2; else im->bpp = 4; + printf("%p: shm++\n", im); } EAPI void