[vlc-devel] [PATCH] decoder: make sure we don't make any damage when changing the decoder_owner
Thomas Guillem
thomas at gllm.fr
Thu Sep 19 13:18:28 CEST 2019
OK
On Thu, Sep 19, 2019, at 09:31, Steve Lhomme wrote:
> The decoder_Destroy() can be called on the dec element of the owner because
> it's the first element of the structure and the owner is actually the decoder
> itself.
> ---
> src/input/decoder.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index 2935e3d6ef7..3e550152b15 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -1758,6 +1758,8 @@ static struct decoder_owner * CreateDecoder(
> vlc_object_t *p_parent,
> {
> decoder_t *p_dec;
> struct decoder_owner *p_owner;
> + static_assert(offsetof(struct decoder_owner, dec) == 0,
> + "the decoder must be first in the owner structure");
>
> p_owner = vlc_custom_create( p_parent, sizeof( *p_owner ), "decoder" );
> if( p_owner == NULL )
> @@ -1978,7 +1980,7 @@ static void DeleteDecoder( decoder_t * p_dec )
> vlc_mutex_destroy( &p_owner->lock );
> vlc_mutex_destroy( &p_owner->mouse_lock );
>
> - decoder_Destroy( p_dec );
> + decoder_Destroy( &p_owner->dec );
> }
>
> /* */
> --
> 2.17.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list