[FFmpeg-devel] [PATCH 2/2] lavd/sdl: reset context variables after destroy

Lukasz Marek lukasz.m.luki at gmail.com
Fri Feb 7 00:31:30 CET 2014


SDL device reports double free or hangs when quiting.
Reseting variables solves the issue.

Signed-off-by: Lukasz Marek <lukasz.m.luki at gmail.com>
---
 libavdevice/sdl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavdevice/sdl.c b/libavdevice/sdl.c
index 2f36f63..bef5041 100644
--- a/libavdevice/sdl.c
+++ b/libavdevice/sdl.c
@@ -71,12 +71,16 @@ static int sdl_write_trailer(AVFormatContext *s)
 
     if (sdl->overlay)
         SDL_FreeYUVOverlay(sdl->overlay);
+    sdl->overlay = NULL;
     if (sdl->event_thread)
         SDL_WaitThread(sdl->event_thread, NULL);
+    sdl->event_thread = NULL;
     if (sdl->mutex)
         SDL_DestroyMutex(sdl->mutex);
+    sdl->mutex = NULL;
     if (sdl->init_cond)
         SDL_DestroyCond(sdl->init_cond);
+    sdl->init_cond = NULL;
 
     if (!sdl->sdl_was_already_inited)
         SDL_Quit();
-- 
1.8.3.2



More information about the ffmpeg-devel mailing list