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 <julien@moutte.net>

* 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.
This commit is contained in:
Julien Moutte 2004-02-17 11:06:52 +00:00
parent f9afb0e75f
commit a3abb5586f
3 changed files with 23 additions and 10 deletions

View file

@ -1,3 +1,10 @@
2004-02-17 Julien MOUTTE <julien@moutte.net>
* 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 <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_renegotiate_size),

View file

@ -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);

View file

@ -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);