[FFmpeg-devel] [PATCH 1/2 v2] avformat/avisynth: remove atexit() handler

Stephen Hutchinson qyot27 at gmail.com
Sun Jul 28 18:59:25 EEST 2024


On 7/28/24 9:38 AM, Ramiro Polla wrote:
>> @@ -1134,6 +1089,7 @@ static av_cold int avisynth_read_close(AVFormatContext *s)
>>           return AVERROR_UNKNOWN;
>>
>>       avisynth_context_destroy(s->priv_data);
>> +    dlclose(avs_library.library);
> 
> Maybe it's best to wrap this around an if (avs_library.library).
> 

True. I had tried toying around with C11 _Thread_local since we now
use C17 as the default std, and in that case there was what I presume
was a double free happening that required adding a check for whether
avs_library.library still existed.  As that hadn't been happening prior
to that test I didn't really think much of it, but yeah, it would
make sense to check it anyway.

I abandoned that general idea after 1) finding out that while GCC and
Clang are fine, MSVC doesn't seem to yet (or if it does, only the
most recent versions of MSVC 2022 do) 2) C23 renamed it to thread_local,
and most importantly, 3) I probably hadn't quite used it entirely
correctly, because while the script could be parsed and played back just
fine, trying to encode anything from it would segfault.



More information about the ffmpeg-devel mailing list