summaryrefslogtreecommitdiff
path: root/src/misc
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/countedobj.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/misc/countedobj.cpp b/src/misc/countedobj.cpp
index 28f614afa..837d1c177 100644
--- a/src/misc/countedobj.cpp
+++ b/src/misc/countedobj.cpp
@@ -25,7 +25,12 @@ int32 SimpleCountedObject::Release()
int32 res = --m_ref_cnt;
assert(res >= 0);
if (res == 0) {
- FinalRelease();
+ try {
+ FinalRelease(); // may throw, for example ScriptTest/ExecMode
+ } catch (...) {
+ delete this;
+ throw;
+ }
delete this;
}
return res;