summaryrefslogtreecommitdiff
path: root/src/3rdparty
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/squirrel/squirrel/sqclass.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/3rdparty/squirrel/squirrel/sqclass.h b/src/3rdparty/squirrel/squirrel/sqclass.h
index 06f2b51e9..895c053c2 100644
--- a/src/3rdparty/squirrel/squirrel/sqclass.h
+++ b/src/3rdparty/squirrel/squirrel/sqclass.h
@@ -128,7 +128,17 @@ public:
}
void Release() {
_uiRef++;
- if (_hook) { _hook(_userpointer,0);}
+ try {
+ if (_hook) { _hook(_userpointer,0);}
+ } catch (...) {
+ _uiRef--;
+ if (_uiRef == 0) {
+ SQInteger size = _memsize;
+ this->~SQInstance();
+ SQ_FREE(this, size);
+ }
+ throw;
+ }
_uiRef--;
if(_uiRef > 0) return;
SQInteger size = _memsize;