mirror of https://github.com/odrling/Aegisub
avisynth: Decrease refcount again when constructor fails
Proper fix to the issue that f5a730fa45
was trying to fix.
Fixes arch1t3cht/Aegisub#61 .
This commit is contained in:
parent
a9eed184c2
commit
858f4acf35
|
@ -53,6 +53,7 @@
|
||||||
// Allocate storage for and initialise static members
|
// Allocate storage for and initialise static members
|
||||||
namespace {
|
namespace {
|
||||||
int avs_refcount = 0;
|
int avs_refcount = 0;
|
||||||
|
bool failed = false;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HINSTANCE hLib = nullptr;
|
HINSTANCE hLib = nullptr;
|
||||||
#else
|
#else
|
||||||
|
@ -66,7 +67,7 @@ const AVS_Linkage *AVS_linkage = nullptr;
|
||||||
|
|
||||||
typedef IScriptEnvironment* __stdcall FUNC(int);
|
typedef IScriptEnvironment* __stdcall FUNC(int);
|
||||||
|
|
||||||
AviSynthWrapper::AviSynthWrapper() {
|
AviSynthWrapper::AviSynthWrapper() try {
|
||||||
if (!avs_refcount++) {
|
if (!avs_refcount++) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define CONCATENATE(x, y) x ## y
|
#define CONCATENATE(x, y) x ## y
|
||||||
|
@ -101,6 +102,9 @@ AviSynthWrapper::AviSynthWrapper() {
|
||||||
if (memoryMax)
|
if (memoryMax)
|
||||||
env->SetMemoryMax(memoryMax);
|
env->SetMemoryMax(memoryMax);
|
||||||
}
|
}
|
||||||
|
} catch (AvisynthError const&) {
|
||||||
|
avs_refcount--;
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
AviSynthWrapper::~AviSynthWrapper() {
|
AviSynthWrapper::~AviSynthWrapper() {
|
||||||
|
|
Loading…
Reference in New Issue