summaryrefslogtreecommitdiff
path: root/libavdevice/sdl.c
diff options
context:
space:
mode:
authorLukasz Marek <lukasz.m.luki@gmail.com>2014-02-07 00:30:27 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-08 12:27:00 +0100
commit20fe316e47fedb28787e77e77a7011133f3d4e73 (patch)
treef43098795201116a857b567d14a9e5bc82288901 /libavdevice/sdl.c
parent18c3313e65f70646858b58fcae6c95308cad0945 (diff)
lavd/sdl: reset context variables after destroy
SDL device reports double free or hangs when quiting. Reseting variables solves the issue. The issue is caused by double call of write_trailer callback. It is called for the first time in write_packet when quit flag is set. Second call comes from ffmpeg.c or may come from other client application. Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice/sdl.c')
-rw-r--r--libavdevice/sdl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavdevice/sdl.c b/libavdevice/sdl.c
index 2f36f632d9..bef50417e7 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();