From: Julien Moutte Date: Tue, 17 Feb 2004 11:06:52 +0000 (+0000) Subject: sys/: Fix a possible SHM leak if we crash. All other apps using XShm are doing that. X-Git-Tag: 1.19.3~511^2~14634 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3abb5586ffd7c7eb95bb4762e442805913ca872;p=platform%2Fupstream%2Fgstreamer.git sys/: Fix a possible SHM leak if we crash. All other apps using XShm are doing that. Original commit message from CVS: 2004-02-17 Julien MOUTTE * sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new): Fix a possible SHM leak if we crash. All other apps using XShm are doing that. --- diff --git a/ChangeLog b/ChangeLog index 8c571fc..492666a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-02-17 Julien MOUTTE + + * sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new): + * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new): Fix a + possible SHM leak if we crash. All other apps using XShm are doing + that. + 2004-02-17 Julien MOUTTE * sys/ximage/ximagesink.c: (gst_ximagesink_renegotiate_size), diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index d727185..4f61ae6 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -178,6 +178,11 @@ gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height) ximage->SHMInfo.readOnly = FALSE; XShmAttach (ximagesink->xcontext->disp, &ximage->SHMInfo); + + XSync (ximagesink->xcontext->disp, FALSE); + + shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0); + ximage->SHMInfo.shmid = -1; } else #endif /* HAVE_XSHM */ @@ -191,13 +196,11 @@ gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height) ximage->width, ximage->height, ximagesink->xcontext->bpp, ximage->width * (ximagesink->xcontext->bpp / 8)); - } - - if (ximage->ximage) - { + XSync (ximagesink->xcontext->disp, FALSE); } - else + + if (!ximage->ximage) { if (ximage->data) g_free (ximage->data); diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index c817a8e..fb0fd2f 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -191,6 +191,11 @@ gst_xvimagesink_xvimage_new (GstXvImageSink *xvimagesink, xvimage->SHMInfo.readOnly = FALSE; XShmAttach (xvimagesink->xcontext->disp, &xvimage->SHMInfo); + + XSync (xvimagesink->xcontext->disp, FALSE); + + shmctl (xvimage->SHMInfo.shmid, IPC_RMID, 0); + xvimage->SHMInfo.shmid = -1; } else #endif /* HAVE_XSHM */ @@ -202,13 +207,11 @@ gst_xvimagesink_xvimage_new (GstXvImageSink *xvimagesink, xvimage->width, xvimage->height); xvimage->data = g_malloc (xvimage->xvimage->data_size); - } - - if (xvimage->xvimage) - { + XSync (xvimagesink->xcontext->disp, FALSE); } - else + + if (!xvimage->xvimage) { if (xvimage->data) g_free (xvimage->data);