1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-22 14:09:10 +00:00

(svn r17230) -Fix (r15027): don't assert when an AI uses AI*Mode objects incorrectly but crash the AI instead

This commit is contained in:
yexo
2009-08-20 10:39:39 +00:00
parent 0960f15c7e
commit 14b5862c22
4 changed files with 33 additions and 3 deletions

View File

@@ -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;