mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
#538 prevent destructors from throwing exceptions
This commit is contained in:
@@ -37,18 +37,25 @@ public:
|
||||
|
||||
~TempFileCollector()
|
||||
{
|
||||
for (std::set<std::string>::iterator it = _files.begin(); it != _files.end(); ++it)
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
File f(*it);
|
||||
if (f.exists())
|
||||
f.remove(true);
|
||||
}
|
||||
catch (Exception&)
|
||||
for (std::set<std::string>::iterator it = _files.begin(); it != _files.end(); ++it)
|
||||
{
|
||||
try
|
||||
{
|
||||
File f(*it);
|
||||
if (f.exists())
|
||||
f.remove(true);
|
||||
}
|
||||
catch (Exception&)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
void registerFile(const std::string& path)
|
||||
@@ -81,17 +88,24 @@ TemporaryFile::TemporaryFile(const std::string& tempDir):
|
||||
|
||||
TemporaryFile::~TemporaryFile()
|
||||
{
|
||||
if (!_keep)
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
if (exists())
|
||||
remove(true);
|
||||
}
|
||||
catch (Exception&)
|
||||
if (!_keep)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (exists())
|
||||
remove(true);
|
||||
}
|
||||
catch (Exception&)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user