From ad443dd1186226f9542e85524c2dda656a2efff6 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Sat, 13 Aug 2022 22:53:58 +0200 Subject: [PATCH] avisynth: Properly destruct the IScriptEnvironment Starting with AVISYNTH_INTERFACE_VERSION=5, this is how script environments should be deleted. The previous code was causing crashes when unloading AviSynth in certain scenarios, such as when failing to open a file due to an incorrect path. --- src/avisynth_wrap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/avisynth_wrap.cpp b/src/avisynth_wrap.cpp index a3b6a3de6..eb957fa3c 100644 --- a/src/avisynth_wrap.cpp +++ b/src/avisynth_wrap.cpp @@ -105,7 +105,7 @@ AviSynthWrapper::AviSynthWrapper() { AviSynthWrapper::~AviSynthWrapper() { if (!--avs_refcount) { - delete env; + env->DeleteScriptEnvironment(); #ifdef _WIN32 FreeLibrary(hLib); #else