From: <th...@fr...> - 2006-02-18 22:45:12
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: thaytan Date: Sat Feb 18 2006 14:41:43 PST Log message: * sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy): * sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy), (gst_xvimagesink_check_xshm_calls), (gst_xvimagesink_xvimage_new): Set shared memory segments to be deleted as soon as we have attached, that way they get cleaned up automatically if we crash. Modified files: . : ChangeLog sys/ximage : ximagesink.c sys/xvimage : xvimagesink.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2397&r2=1.2398 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/sys/ximage/ximagesink.c.diff?r1=1.153&r2=1.154 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/sys/xvimage/xvimagesink.c.diff?r1=1.144&r2=1.145 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2397 retrieving revision 1.2398 diff -u -d -r1.2397 -r1.2398 --- ChangeLog 18 Feb 2006 19:53:48 -0000 1.2397 +++ ChangeLog 18 Feb 2006 22:41:31 -0000 1.2398 @@ -1,3 +1,12 @@ +2006-02-18 Jan Schmidt <th...@ma...> + + * sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls), + (gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy): + * sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy), + (gst_xvimagesink_check_xshm_calls), (gst_xvimagesink_xvimage_new): + Set shared memory segments to be deleted as soon as we have attached, + that way they get cleaned up automatically if we crash. 2006-02-18 Julien MOUTTE <ju...@mo...> * ext/pango/gstclockoverlay.c: (gst_clock_overlay_get_text): Index: ximagesink.c RCS file: /cvs/gstreamer/gst-plugins-base/sys/ximage/ximagesink.c,v retrieving revision 1.153 retrieving revision 1.154 diff -u -d -r1.153 -r1.154 --- ximagesink.c 11 Feb 2006 23:35:55 -0000 1.153 +++ ximagesink.c 18 Feb 2006 22:41:31 -0000 1.154 @@ -342,9 +342,16 @@ SHMInfo.shmaddr = shmat (SHMInfo.shmid, 0, 0); if (SHMInfo.shmaddr == ((void *) -1)) { GST_WARNING ("Failed to shmat: %s", g_strerror (errno)); + /* Clean up shm seg */ + shmctl (SHMInfo.shmid, IPC_RMID, 0); goto beach; } + /* Delete the shared memory segment as soon as we manage to attach. + * This way, it will be deleted as soon as we detach later, and not + * leaked if we crash. */ + shmctl (SHMInfo.shmid, IPC_RMID, 0); ximage->data = SHMInfo.shmaddr; SHMInfo.readOnly = FALSE; @@ -374,8 +381,6 @@ if (SHMInfo.shmaddr != ((void *) -1)) shmdt (SHMInfo.shmaddr); - if (SHMInfo.shmid > 0) - shmctl (SHMInfo.shmid, IPC_RMID, 0); if (ximage) XDestroyImage (ximage); return result; @@ -435,9 +440,16 @@ if (ximage->SHMInfo.shmaddr == ((void *) -1)) { GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE, (NULL), ("Failed to shmat: %s", g_strerror (errno))); + /* Clean up the shared memory segment */ + shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0); goto beach; } + /* Now that we've attached, we can delete the shared memory segment. + * This way, it will be deleted as soon as we detach later, and not + * leaked if we crash. */ + shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0); ximage->ximage->data = ximage->SHMInfo.shmaddr; ximage->SHMInfo.readOnly = FALSE; @@ -514,8 +526,6 @@ XSync (ximagesink->xcontext->disp, 0); shmdt (ximage->SHMInfo.shmaddr); - if (ximage->SHMInfo.shmid > 0) - shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0); if (ximage->ximage) XDestroyImage (ximage->ximage); Index: xvimagesink.c RCS file: /cvs/gstreamer/gst-plugins-base/sys/xvimage/xvimagesink.c,v retrieving revision 1.144 retrieving revision 1.145 diff -u -d -r1.144 -r1.145 --- xvimagesink.c 11 Feb 2006 23:35:55 -0000 1.144 +++ xvimagesink.c 18 Feb 2006 22:41:31 -0000 1.145 @@ -237,8 +237,6 @@ XSync (xvimagesink->xcontext->disp, FALSE); shmdt (xvimage->SHMInfo.shmaddr); - if (xvimage->SHMInfo.shmid > 0) - shmctl (xvimage->SHMInfo.shmid, IPC_RMID, 0); if (xvimage->xvimage) XFree (xvimage->xvimage); } else @@ -419,9 +417,16 @@ + /* Clean up the shared memory segment */ + /* Delete the shared memory segment as soon as we manage to attach. xvimage->data = SHMInfo.shmaddr; @@ -452,8 +457,6 @@ if (xvimage) XFree (xvimage); @@ -521,9 +524,16 @@ if (xvimage->SHMInfo.shmaddr == ((void *) -1)) { GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE, (NULL), + shmctl (xvimage->SHMInfo.shmid, IPC_RMID, 0); + /* Delete the shared memory segment as soon as we manage to attach. + shmctl (xvimage->SHMInfo.shmid, IPC_RMID, 0); xvimage->xvimage->data = xvimage->SHMInfo.shmaddr; xvimage->SHMInfo.readOnly = FALSE; |