mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
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:
parent
f9afb0e75f
commit
a3abb5586f
3 changed files with 23 additions and 10 deletions
|
@ -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>
|
2004-02-17 Julien MOUTTE <julien@moutte.net>
|
||||||
|
|
||||||
* sys/ximage/ximagesink.c: (gst_ximagesink_renegotiate_size),
|
* sys/ximage/ximagesink.c: (gst_ximagesink_renegotiate_size),
|
||||||
|
|
|
@ -178,6 +178,11 @@ gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
|
||||||
ximage->SHMInfo.readOnly = FALSE;
|
ximage->SHMInfo.readOnly = FALSE;
|
||||||
|
|
||||||
XShmAttach (ximagesink->xcontext->disp, &ximage->SHMInfo);
|
XShmAttach (ximagesink->xcontext->disp, &ximage->SHMInfo);
|
||||||
|
|
||||||
|
XSync (ximagesink->xcontext->disp, FALSE);
|
||||||
|
|
||||||
|
shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0);
|
||||||
|
ximage->SHMInfo.shmid = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* HAVE_XSHM */
|
#endif /* HAVE_XSHM */
|
||||||
|
@ -191,13 +196,11 @@ gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
|
||||||
ximage->width, ximage->height,
|
ximage->width, ximage->height,
|
||||||
ximagesink->xcontext->bpp,
|
ximagesink->xcontext->bpp,
|
||||||
ximage->width * (ximagesink->xcontext->bpp / 8));
|
ximage->width * (ximagesink->xcontext->bpp / 8));
|
||||||
}
|
|
||||||
|
|
||||||
if (ximage->ximage)
|
|
||||||
{
|
|
||||||
XSync (ximagesink->xcontext->disp, FALSE);
|
XSync (ximagesink->xcontext->disp, FALSE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!ximage->ximage)
|
||||||
{
|
{
|
||||||
if (ximage->data)
|
if (ximage->data)
|
||||||
g_free (ximage->data);
|
g_free (ximage->data);
|
||||||
|
|
|
@ -191,6 +191,11 @@ gst_xvimagesink_xvimage_new (GstXvImageSink *xvimagesink,
|
||||||
xvimage->SHMInfo.readOnly = FALSE;
|
xvimage->SHMInfo.readOnly = FALSE;
|
||||||
|
|
||||||
XShmAttach (xvimagesink->xcontext->disp, &xvimage->SHMInfo);
|
XShmAttach (xvimagesink->xcontext->disp, &xvimage->SHMInfo);
|
||||||
|
|
||||||
|
XSync (xvimagesink->xcontext->disp, FALSE);
|
||||||
|
|
||||||
|
shmctl (xvimage->SHMInfo.shmid, IPC_RMID, 0);
|
||||||
|
xvimage->SHMInfo.shmid = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* HAVE_XSHM */
|
#endif /* HAVE_XSHM */
|
||||||
|
@ -202,13 +207,11 @@ gst_xvimagesink_xvimage_new (GstXvImageSink *xvimagesink,
|
||||||
xvimage->width, xvimage->height);
|
xvimage->width, xvimage->height);
|
||||||
|
|
||||||
xvimage->data = g_malloc (xvimage->xvimage->data_size);
|
xvimage->data = g_malloc (xvimage->xvimage->data_size);
|
||||||
}
|
|
||||||
|
|
||||||
if (xvimage->xvimage)
|
|
||||||
{
|
|
||||||
XSync (xvimagesink->xcontext->disp, FALSE);
|
XSync (xvimagesink->xcontext->disp, FALSE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!xvimage->xvimage)
|
||||||
{
|
{
|
||||||
if (xvimage->data)
|
if (xvimage->data)
|
||||||
g_free (xvimage->data);
|
g_free (xvimage->data);
|
||||||
|
|
Loading…
Reference in a new issue