0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

player: actually initialize/destroy MPContext.lock

Seems like quite on oversight.

For most of the better pthread implementations, pthread_mutex_init() on
an already 0-initialized memory block is probably a no-op, but of course
we should do things correctly. Also could setup analysis tools.
This commit is contained in:
wm4 2017-01-22 15:23:35 +01:00
parent 06c55ac6c3
commit 5c942128d8

View File

@ -199,6 +199,7 @@ void mp_destroy(struct MPContext *mpctx)
pthread_detach(pthread_self());
mp_msg_uninit(mpctx->global);
pthread_mutex_destroy(&mpctx->lock);
talloc_free(mpctx);
}
@ -335,6 +336,8 @@ struct MPContext *mp_create(void)
.playback_abort = mp_cancel_new(mpctx),
};
pthread_mutex_init(&mpctx->lock, NULL);
mpctx->global = talloc_zero(mpctx, struct mpv_global);
// Nothing must call mp_msg*() and related before this