File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5353// Allocate storage for and initialise static members
5454namespace {
5555 int avs_refcount = 0 ;
56+ bool failed = false ;
5657#ifdef _WIN32
5758 HINSTANCE hLib = nullptr ;
5859#else
@@ -66,8 +67,8 @@ const AVS_Linkage *AVS_linkage = nullptr;
6667
6768typedef IScriptEnvironment* __stdcall FUNC (int );
6869
69- AviSynthWrapper::AviSynthWrapper () {
70- if (!avs_refcount) {
70+ AviSynthWrapper::AviSynthWrapper () try {
71+ if (!avs_refcount++) {
7172#ifdef _WIN32
7273#define CONCATENATE (x, y ) x ## y
7374#define _Lstr (x ) CONCATENATE (L, x)
@@ -94,15 +95,16 @@ AviSynthWrapper::AviSynthWrapper() {
9495 if (!env)
9596 throw AvisynthError (" Failed to create a new avisynth script environment. Avisynth is too old?" );
9697
97- avs_refcount++;
98-
9998 AVS_linkage = env->GetAVSLinkage ();
10099
101100 // Set memory limit
102101 const int memoryMax = OPT_GET (" Provider/Avisynth/Memory Max" )->GetInt ();
103102 if (memoryMax)
104103 env->SetMemoryMax (memoryMax);
105104 }
105+ } catch (AvisynthError const &) {
106+ avs_refcount--;
107+ throw ;
106108}
107109
108110AviSynthWrapper::~AviSynthWrapper () {
You can’t perform that action at this time.
0 commit comments