summaryrefslogtreecommitdiff
path: root/src/3rdparty
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-08-20 10:39:39 +0000
committeryexo <yexo@openttd.org>2009-08-20 10:39:39 +0000
commit14b5862c229a7003fbb0dc259386dc1153048c56 (patch)
tree7b9b888a24c43d2028d72eb4b44c1b284cbfb094 /src/3rdparty
parent0960f15c7ed46ac71881456ed71dfcd0a33ae4bb (diff)
downloadopenttd-14b5862c229a7003fbb0dc259386dc1153048c56.tar.xz
(svn r17230) -Fix (r15027): don't assert when an AI uses AI*Mode objects incorrectly but crash the AI instead
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;