(svn r27379) -Codechange: Do not throw in the destructors of ScriptTest/ExecMode.

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
frosch 9 years ago
parent d818e1779c
commit e5d105900d

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

@ -30,7 +30,7 @@ ScriptExecMode::ScriptExecMode()
this->SetDoCommandMode(&ScriptExecMode::ModeProc, this);
}
ScriptExecMode::~ScriptExecMode()
void ScriptExecMode::FinalRelease()
{
if (this->GetDoCommandModeInstance() != this) {
/* Ignore this error if the script already died. */
@ -38,5 +38,9 @@ ScriptExecMode::~ScriptExecMode()
throw Script_FatalError("ScriptExecMode object was removed while it was not the latest *Mode object created.");
}
}
}
ScriptExecMode::~ScriptExecMode()
{
this->SetDoCommandMode(this->last_mode, this->last_instance);
}

@ -46,6 +46,8 @@ public:
* in when the instance was created.
*/
~ScriptExecMode();
virtual void FinalRelease();
};
#endif /* SCRIPT_EXECMODE_HPP */

@ -30,7 +30,7 @@ ScriptTestMode::ScriptTestMode()
this->SetDoCommandMode(&ScriptTestMode::ModeProc, this);
}
ScriptTestMode::~ScriptTestMode()
void ScriptTestMode::FinalRelease()
{
if (this->GetDoCommandModeInstance() != this) {
/* Ignore this error if the script already died. */
@ -38,5 +38,9 @@ ScriptTestMode::~ScriptTestMode()
throw Script_FatalError("Testmode object was removed while it was not the latest *Mode object created.");
}
}
}
ScriptTestMode::~ScriptTestMode()
{
this->SetDoCommandMode(this->last_mode, this->last_instance);
}

@ -48,6 +48,8 @@ public:
* in when the instance was created.
*/
~ScriptTestMode();
virtual void FinalRelease();
};
#endif /* SCRIPT_TESTMODE_HPP */

Loading…
Cancel
Save