Example
Class::~Class() {
// Clean up references to memory ...
int
error = cleanUp();
if
(error)
{
throw
str;
}
logDestruction();
// May throw exception
}
Solution
Ensure no exceptions leave the destructor by catching all exceptions.
Class::~Class() {
try
{
// Clean up references to memory
delete
pointer;
logDestruction();
}
catch
( ... ) {
// catch all errors here
}
}