mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-27 08:46:17 +01:00
#538 prevent destructors from throwing exceptions
This commit is contained in:
parent
c8686a727d
commit
544229302e
@ -47,7 +47,14 @@ OpenSSLInitializer::OpenSSLInitializer()
|
||||
|
||||
OpenSSLInitializer::~OpenSSLInitializer()
|
||||
{
|
||||
uninitialize();
|
||||
try
|
||||
{
|
||||
uninitialize();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,7 +33,14 @@ PooledSessionImpl::PooledSessionImpl(PooledSessionHolder* pHolder):
|
||||
|
||||
PooledSessionImpl::~PooledSessionImpl()
|
||||
{
|
||||
close();
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,13 +75,20 @@ RecordSet::RecordSet(const RecordSet& other):
|
||||
|
||||
RecordSet::~RecordSet()
|
||||
{
|
||||
delete _pBegin;
|
||||
delete _pEnd;
|
||||
if(_pFilter) _pFilter->release();
|
||||
try
|
||||
{
|
||||
delete _pBegin;
|
||||
delete _pEnd;
|
||||
if(_pFilter) _pFilter->release();
|
||||
|
||||
RowMap::iterator it = _rowMap.begin();
|
||||
RowMap::iterator end = _rowMap.end();
|
||||
for (; it != end; ++it) delete it->second;
|
||||
RowMap::iterator it = _rowMap.begin();
|
||||
RowMap::iterator end = _rowMap.end();
|
||||
for (; it != end; ++it) delete it->second;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,9 +60,16 @@ void RowFilter::init()
|
||||
|
||||
RowFilter::~RowFilter()
|
||||
{
|
||||
release();
|
||||
if (_pRecordSet) _pRecordSet->filter(0);
|
||||
if (_pParent.get()) _pParent->removeFilter(this);
|
||||
try
|
||||
{
|
||||
release();
|
||||
if (_pRecordSet) _pRecordSet->filter(0);
|
||||
if (_pParent.get()) _pParent->removeFilter(this);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,7 +69,14 @@ SQLChannel::SQLChannel(const std::string& connector,
|
||||
|
||||
SQLChannel::~SQLChannel()
|
||||
{
|
||||
close();
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,14 @@ SessionPool::SessionPool(const std::string& connector, const std::string& connec
|
||||
|
||||
SessionPool::~SessionPool()
|
||||
{
|
||||
shutdown();
|
||||
try
|
||||
{
|
||||
shutdown();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,21 +40,28 @@ Transaction::Transaction(Poco::Data::Session& rSession, bool start):
|
||||
|
||||
Transaction::~Transaction()
|
||||
{
|
||||
if (_rSession.isTransaction())
|
||||
try
|
||||
{
|
||||
try
|
||||
if (_rSession.isTransaction())
|
||||
{
|
||||
if (_pLogger)
|
||||
_pLogger->debug("Rolling back transaction.");
|
||||
try
|
||||
{
|
||||
if (_pLogger)
|
||||
_pLogger->debug("Rolling back transaction.");
|
||||
|
||||
_rSession.rollback();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (_pLogger)
|
||||
_pLogger->error("Error while rolling back database transaction.");
|
||||
_rSession.rollback();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (_pLogger)
|
||||
_pLogger->error("Error while rolling back database transaction.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,7 +64,14 @@ public:
|
||||
|
||||
virtual ~AbstractCache()
|
||||
{
|
||||
uninitialize();
|
||||
try
|
||||
{
|
||||
uninitialize();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
void add(const TKey& key, const TValue& val)
|
||||
|
@ -94,8 +94,15 @@ public:
|
||||
~Activity()
|
||||
/// Stops and destroys the activity.
|
||||
{
|
||||
stop();
|
||||
wait();
|
||||
try
|
||||
{
|
||||
stop();
|
||||
wait();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
void start()
|
||||
|
@ -58,7 +58,6 @@ union Placeholder
|
||||
/// where the object was allocated (0 => heap, 1 => local).
|
||||
{
|
||||
public:
|
||||
|
||||
struct Size
|
||||
{
|
||||
static const unsigned int value = SizeV;
|
||||
@ -86,7 +85,7 @@ public:
|
||||
|
||||
PlaceholderT* content() const
|
||||
{
|
||||
if(isLocal())
|
||||
if (isLocal())
|
||||
return reinterpret_cast<PlaceholderT*>(holder);
|
||||
else
|
||||
return pHolder;
|
||||
@ -192,9 +191,9 @@ public:
|
||||
/// Destructor. If Any is locally held, calls ValueHolder destructor;
|
||||
/// otherwise, deletes the placeholder from the heap.
|
||||
{
|
||||
if(!empty())
|
||||
if (!empty())
|
||||
{
|
||||
if(_valueHolder.isLocal())
|
||||
if (_valueHolder.isLocal())
|
||||
destruct();
|
||||
else
|
||||
delete content();
|
||||
@ -341,7 +340,7 @@ private:
|
||||
|
||||
void construct(const Any& other)
|
||||
{
|
||||
if(!other.empty())
|
||||
if (!other.empty())
|
||||
other.content()->clone(&_valueHolder);
|
||||
else
|
||||
_valueHolder.erase();
|
||||
|
@ -167,7 +167,7 @@ private:
|
||||
|
||||
|
||||
template <typename T>
|
||||
class BasicMemoryBinaryWriter : public BinaryWriter
|
||||
class BasicMemoryBinaryWriter: public BinaryWriter
|
||||
/// A convenient wrapper for using Buffer and MemoryStream with BinarWriter.
|
||||
{
|
||||
public:
|
||||
@ -187,7 +187,14 @@ public:
|
||||
|
||||
~BasicMemoryBinaryWriter()
|
||||
{
|
||||
flush();
|
||||
try
|
||||
{
|
||||
flush();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
Buffer<T>& data()
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
return new char_type[static_cast<std::size_t>(size)];
|
||||
}
|
||||
|
||||
static void deallocate(char_type* ptr, std::streamsize /*size*/)
|
||||
static void deallocate(char_type* ptr, std::streamsize /*size*/) throw()
|
||||
{
|
||||
delete [] ptr;
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ private:
|
||||
|
||||
void destruct()
|
||||
{
|
||||
if(!isEmpty()) delete content();
|
||||
if (!isEmpty()) delete content();
|
||||
}
|
||||
|
||||
VarHolder* _pHolder;
|
||||
@ -636,7 +636,7 @@ private:
|
||||
|
||||
void construct(const Var& other)
|
||||
{
|
||||
if(!other.isEmpty())
|
||||
if (!other.isEmpty())
|
||||
other.content()->clone(&_placeholder);
|
||||
else
|
||||
_placeholder.erase();
|
||||
@ -644,9 +644,9 @@ private:
|
||||
|
||||
void destruct()
|
||||
{
|
||||
if(!isEmpty())
|
||||
if (!isEmpty())
|
||||
{
|
||||
if(_placeholder.isLocal())
|
||||
if (_placeholder.isLocal())
|
||||
content()->~VarHolder();
|
||||
else
|
||||
delete content();
|
||||
|
@ -151,7 +151,14 @@ inline NDCScope::NDCScope(const std::string& info, int line, const char* filenam
|
||||
|
||||
inline NDCScope::~NDCScope()
|
||||
{
|
||||
NestedDiagnosticContext::current().pop();
|
||||
try
|
||||
{
|
||||
NestedDiagnosticContext::current().pop();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -194,9 +194,16 @@ public:
|
||||
~ObjectPool()
|
||||
/// Destroys the ObjectPool.
|
||||
{
|
||||
for (typename std::vector<P>::iterator it = _pool.begin(); it != _pool.end(); ++it)
|
||||
try
|
||||
{
|
||||
_factory.destroyObject(*it);
|
||||
for (typename std::vector<P>::iterator it = _pool.begin(); it != _pool.end(); ++it)
|
||||
{
|
||||
_factory.destroyObject(*it);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,14 @@ inline ScopedRWLock::ScopedRWLock(RWLock& rwl, bool write): _rwl(rwl)
|
||||
|
||||
inline ScopedRWLock::~ScopedRWLock()
|
||||
{
|
||||
_rwl.unlock();
|
||||
try
|
||||
{
|
||||
_rwl.unlock();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
void duplicate() const;
|
||||
/// Increments the object's reference count.
|
||||
|
||||
void release() const;
|
||||
void release() const throw();
|
||||
/// Decrements the object's reference count
|
||||
/// and deletes the object if the count
|
||||
/// reaches zero.
|
||||
@ -77,9 +77,16 @@ inline void RefCountedObject::duplicate() const
|
||||
}
|
||||
|
||||
|
||||
inline void RefCountedObject::release() const
|
||||
inline void RefCountedObject::release() const throw()
|
||||
{
|
||||
if (--_counter == 0) delete this;
|
||||
try
|
||||
{
|
||||
if (--_counter == 0) delete this;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,7 +47,14 @@ public:
|
||||
|
||||
~ScopedLock()
|
||||
{
|
||||
_mutex.unlock();
|
||||
try
|
||||
{
|
||||
_mutex.unlock();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -82,7 +89,14 @@ public:
|
||||
|
||||
~ScopedLockWithUnlock()
|
||||
{
|
||||
unlock();
|
||||
try
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
void unlock()
|
||||
|
@ -143,7 +143,14 @@ public:
|
||||
|
||||
~SharedPtr()
|
||||
{
|
||||
release();
|
||||
try
|
||||
{
|
||||
release();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
SharedPtr& assign(C* ptr)
|
||||
|
@ -59,8 +59,15 @@ AsyncChannel::AsyncChannel(Channel* pChannel, Thread::Priority prio):
|
||||
|
||||
AsyncChannel::~AsyncChannel()
|
||||
{
|
||||
close();
|
||||
if (_pChannel) _pChannel->release();
|
||||
try
|
||||
{
|
||||
close();
|
||||
if (_pChannel) _pChannel->release();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -541,8 +541,15 @@ DirectoryWatcher::DirectoryWatcher(const Poco::File& directory, int eventMask, i
|
||||
|
||||
DirectoryWatcher::~DirectoryWatcher()
|
||||
{
|
||||
stop();
|
||||
delete _pStrategy;
|
||||
try
|
||||
{
|
||||
stop();
|
||||
delete _pStrategy;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,7 +81,14 @@ EventLogChannel::EventLogChannel(const std::string& name, const std::string& hos
|
||||
|
||||
EventLogChannel::~EventLogChannel()
|
||||
{
|
||||
close();
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,10 +71,17 @@ FileChannel::FileChannel(const std::string& path):
|
||||
|
||||
FileChannel::~FileChannel()
|
||||
{
|
||||
close();
|
||||
delete _pRotateStrategy;
|
||||
delete _pArchiveStrategy;
|
||||
delete _pPurgeStrategy;
|
||||
try
|
||||
{
|
||||
close();
|
||||
delete _pRotateStrategy;
|
||||
delete _pArchiveStrategy;
|
||||
delete _pPurgeStrategy;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -444,7 +444,14 @@ public:
|
||||
}
|
||||
~AutoLoggerShutdown()
|
||||
{
|
||||
Logger::shutdown();
|
||||
try
|
||||
{
|
||||
Logger::shutdown();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -30,7 +30,14 @@ NotificationQueue::NotificationQueue()
|
||||
|
||||
NotificationQueue::~NotificationQueue()
|
||||
{
|
||||
clear();
|
||||
try
|
||||
{
|
||||
clear();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,7 +30,14 @@ PriorityNotificationQueue::PriorityNotificationQueue()
|
||||
|
||||
PriorityNotificationQueue::~PriorityNotificationQueue()
|
||||
{
|
||||
clear();
|
||||
try
|
||||
{
|
||||
clear();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,7 +52,14 @@ SimpleFileChannel::SimpleFileChannel(const std::string& path):
|
||||
|
||||
SimpleFileChannel::~SimpleFileChannel()
|
||||
{
|
||||
close();
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -280,7 +280,14 @@ ThreadPool::ThreadPool(const std::string& name,
|
||||
|
||||
ThreadPool::~ThreadPool()
|
||||
{
|
||||
stopAll();
|
||||
try
|
||||
{
|
||||
stopAll();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,7 +29,14 @@ TimedNotificationQueue::TimedNotificationQueue()
|
||||
|
||||
TimedNotificationQueue::~TimedNotificationQueue()
|
||||
{
|
||||
clear();
|
||||
try
|
||||
{
|
||||
clear();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,7 +35,14 @@ Timer::Timer(long startInterval, long periodicInterval):
|
||||
|
||||
Timer::~Timer()
|
||||
{
|
||||
stop();
|
||||
try
|
||||
{
|
||||
stop();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -85,7 +85,7 @@ const Var Var::operator + (const Var& other) const
|
||||
{
|
||||
if (isInteger())
|
||||
{
|
||||
if(isSigned())
|
||||
if (isSigned())
|
||||
return add<Poco::Int64>(other);
|
||||
else
|
||||
return add<Poco::UInt64>(other);
|
||||
@ -103,7 +103,7 @@ Var& Var::operator += (const Var& other)
|
||||
{
|
||||
if (isInteger())
|
||||
{
|
||||
if(isSigned())
|
||||
if (isSigned())
|
||||
return *this = add<Poco::Int64>(other);
|
||||
else
|
||||
return *this = add<Poco::UInt64>(other);
|
||||
@ -121,7 +121,7 @@ const Var Var::operator - (const Var& other) const
|
||||
{
|
||||
if (isInteger())
|
||||
{
|
||||
if(isSigned())
|
||||
if (isSigned())
|
||||
return subtract<Poco::Int64>(other);
|
||||
else
|
||||
return subtract<Poco::UInt64>(other);
|
||||
@ -137,7 +137,7 @@ Var& Var::operator -= (const Var& other)
|
||||
{
|
||||
if (isInteger())
|
||||
{
|
||||
if(isSigned())
|
||||
if (isSigned())
|
||||
return *this = subtract<Poco::Int64>(other);
|
||||
else
|
||||
return *this = subtract<Poco::UInt64>(other);
|
||||
@ -153,7 +153,7 @@ const Var Var::operator * (const Var& other) const
|
||||
{
|
||||
if (isInteger())
|
||||
{
|
||||
if(isSigned())
|
||||
if (isSigned())
|
||||
return multiply<Poco::Int64>(other);
|
||||
else
|
||||
return multiply<Poco::UInt64>(other);
|
||||
@ -169,7 +169,7 @@ Var& Var::operator *= (const Var& other)
|
||||
{
|
||||
if (isInteger())
|
||||
{
|
||||
if(isSigned())
|
||||
if (isSigned())
|
||||
return *this = multiply<Poco::Int64>(other);
|
||||
else
|
||||
return *this = multiply<Poco::UInt64>(other);
|
||||
@ -185,7 +185,7 @@ const Var Var::operator / (const Var& other) const
|
||||
{
|
||||
if (isInteger())
|
||||
{
|
||||
if(isSigned())
|
||||
if (isSigned())
|
||||
return divide<Poco::Int64>(other);
|
||||
else
|
||||
return divide<Poco::UInt64>(other);
|
||||
@ -201,7 +201,7 @@ Var& Var::operator /= (const Var& other)
|
||||
{
|
||||
if (isInteger())
|
||||
{
|
||||
if(isSigned())
|
||||
if (isSigned())
|
||||
return *this = divide<Poco::Int64>(other);
|
||||
else
|
||||
return *this = divide<Poco::UInt64>(other);
|
||||
|
@ -84,7 +84,14 @@ public:
|
||||
|
||||
virtual ~PooledConnection()
|
||||
{
|
||||
_pool.returnObject(_connection);
|
||||
try
|
||||
{
|
||||
_pool.returnObject(_connection);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
operator Connection::Ptr ()
|
||||
|
@ -87,7 +87,14 @@ public:
|
||||
virtual ~ParallelSocketAcceptor()
|
||||
/// Destroys the ParallelSocketAcceptor.
|
||||
{
|
||||
unregisterAcceptor();
|
||||
try
|
||||
{
|
||||
unregisterAcceptor();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void registerAcceptor(SocketReactor& reactor)
|
||||
|
@ -88,7 +88,14 @@ public:
|
||||
virtual ~SocketAcceptor()
|
||||
/// Destroys the SocketAcceptor.
|
||||
{
|
||||
unregisterAcceptor();
|
||||
try
|
||||
{
|
||||
unregisterAcceptor();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void registerAcceptor(SocketReactor& reactor)
|
||||
|
@ -92,7 +92,14 @@ public:
|
||||
virtual ~SocketConnector()
|
||||
/// Destroys the SocketConnector.
|
||||
{
|
||||
unregisterConnector();
|
||||
try
|
||||
{
|
||||
unregisterConnector();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void registerConnector(SocketReactor& reactor)
|
||||
|
@ -161,7 +161,14 @@ void* HTTPChunkedInputStream::operator new(std::size_t size)
|
||||
|
||||
void HTTPChunkedInputStream::operator delete(void* ptr)
|
||||
{
|
||||
_pool.release(ptr);
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -193,7 +200,14 @@ void* HTTPChunkedOutputStream::operator new(std::size_t size)
|
||||
|
||||
void HTTPChunkedOutputStream::operator delete(void* ptr)
|
||||
{
|
||||
_pool.release(ptr);
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,7 +130,14 @@ void* HTTPFixedLengthInputStream::operator new(std::size_t size)
|
||||
|
||||
void HTTPFixedLengthInputStream::operator delete(void* ptr)
|
||||
{
|
||||
_pool.release(ptr);
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -162,7 +169,14 @@ void* HTTPFixedLengthOutputStream::operator new(std::size_t size)
|
||||
|
||||
void HTTPFixedLengthOutputStream::operator delete(void* ptr)
|
||||
{
|
||||
_pool.release(ptr);
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -127,7 +127,14 @@ void* HTTPHeaderInputStream::operator new(std::size_t size)
|
||||
|
||||
void HTTPHeaderInputStream::operator delete(void* ptr)
|
||||
{
|
||||
_pool.release(ptr);
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -159,7 +166,14 @@ void* HTTPHeaderOutputStream::operator new(std::size_t size)
|
||||
|
||||
void HTTPHeaderOutputStream::operator delete(void* ptr)
|
||||
{
|
||||
_pool.release(ptr);
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +45,14 @@ HTTPServerConnection::HTTPServerConnection(const StreamSocket& socket, HTTPServe
|
||||
|
||||
HTTPServerConnection::~HTTPServerConnection()
|
||||
{
|
||||
_pFactory->serverStopped -= Poco::delegate(this, &HTTPServerConnection::onServerStopped);
|
||||
try
|
||||
{
|
||||
_pFactory->serverStopped -= Poco::delegate(this, &HTTPServerConnection::onServerStopped);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,15 +64,22 @@ HTTPSession::HTTPSession(const StreamSocket& socket, bool keepAlive):
|
||||
|
||||
HTTPSession::~HTTPSession()
|
||||
{
|
||||
if (_pBuffer) HTTPBufferAllocator::deallocate(_pBuffer, HTTPBufferAllocator::BUFFER_SIZE);
|
||||
try
|
||||
{
|
||||
close();
|
||||
if (_pBuffer) HTTPBufferAllocator::deallocate(_pBuffer, HTTPBufferAllocator::BUFFER_SIZE);
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
delete _pException;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
delete _pException;
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,7 +121,14 @@ void* HTTPInputStream::operator new(std::size_t size)
|
||||
|
||||
void HTTPInputStream::operator delete(void* ptr)
|
||||
{
|
||||
_pool.release(ptr);
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +160,14 @@ void* HTTPOutputStream::operator new(std::size_t size)
|
||||
|
||||
void HTTPOutputStream::operator delete(void* ptr)
|
||||
{
|
||||
_pool.release(ptr);
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,7 +131,13 @@ MultipartIOS::MultipartIOS(std::istream& istr, const std::string& boundary):
|
||||
|
||||
MultipartIOS::~MultipartIOS()
|
||||
{
|
||||
_buf.sync();
|
||||
try
|
||||
{
|
||||
_buf.sync();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +62,14 @@ void Net_API uninitializeNetwork()
|
||||
~NetworkInitializer()
|
||||
/// Calls Poco::Net::uninitializeNetwork();
|
||||
{
|
||||
Poco::Net::uninitializeNetwork();
|
||||
try
|
||||
{
|
||||
Poco::Net::uninitializeNetwork();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -24,7 +24,10 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
/// PartStore
|
||||
//
|
||||
// PartStore
|
||||
//
|
||||
|
||||
|
||||
PartStore::PartStore(const std::string& mediaType): PartSource(mediaType)
|
||||
{
|
||||
@ -36,7 +39,10 @@ PartStore::~PartStore()
|
||||
}
|
||||
|
||||
|
||||
/// FilePartStore
|
||||
//
|
||||
// FilePartStore
|
||||
//
|
||||
|
||||
|
||||
FilePartStore::FilePartStore(const std::string& content, const std::string& mediaType, const std::string& filename):
|
||||
PartStore(mediaType),
|
||||
@ -56,7 +62,7 @@ FilePartStore::~FilePartStore()
|
||||
_fstr.close();
|
||||
File(_path).remove();
|
||||
}
|
||||
catch (Exception&)
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,14 @@ RemoteSyslogChannel::RemoteSyslogChannel(const std::string& address, const std::
|
||||
|
||||
RemoteSyslogChannel::~RemoteSyslogChannel()
|
||||
{
|
||||
close();
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,7 +69,14 @@ SMTPChannel::SMTPChannel(const std::string& mailhost, const std::string& sender,
|
||||
|
||||
SMTPChannel::~SMTPChannel()
|
||||
{
|
||||
close();
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <stropts.h>
|
||||
#endif
|
||||
|
||||
|
||||
using Poco::IOException;
|
||||
using Poco::TimeoutException;
|
||||
using Poco::InvalidArgumentException;
|
||||
|
@ -72,8 +72,15 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool&
|
||||
|
||||
TCPServer::~TCPServer()
|
||||
{
|
||||
stop();
|
||||
_pDispatcher->release();
|
||||
try
|
||||
{
|
||||
stop();
|
||||
_pDispatcher->release();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "Poco/MemoryStream.h"
|
||||
#include "Poco/Format.h"
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Net {
|
||||
@ -42,8 +42,15 @@ WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, bool mustMaskP
|
||||
|
||||
WebSocketImpl::~WebSocketImpl()
|
||||
{
|
||||
_pStreamSocketImpl->release();
|
||||
reset();
|
||||
try
|
||||
{
|
||||
_pStreamSocketImpl->release();
|
||||
reset();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -168,9 +168,15 @@ Context::Context(
|
||||
|
||||
Context::~Context()
|
||||
{
|
||||
SSL_CTX_free(_pSSLContext);
|
||||
|
||||
Poco::Crypto::OpenSSLInitializer::uninitialize();
|
||||
try
|
||||
{
|
||||
SSL_CTX_free(_pSSLContext);
|
||||
Poco::Crypto::OpenSSLInitializer::uninitialize();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,10 +37,17 @@ InvalidCertificateHandler::InvalidCertificateHandler(bool handleErrorsOnServerSi
|
||||
|
||||
InvalidCertificateHandler::~InvalidCertificateHandler()
|
||||
{
|
||||
if (_handleErrorsOnServerSide)
|
||||
SSLManager::instance().ServerVerificationError -= Delegate<InvalidCertificateHandler, VerificationErrorArgs>(this, &InvalidCertificateHandler::onInvalidCertificate);
|
||||
else
|
||||
SSLManager::instance().ClientVerificationError -= Delegate<InvalidCertificateHandler, VerificationErrorArgs>(this, &InvalidCertificateHandler::onInvalidCertificate);
|
||||
try
|
||||
{
|
||||
if (_handleErrorsOnServerSide)
|
||||
SSLManager::instance().ServerVerificationError -= Delegate<InvalidCertificateHandler, VerificationErrorArgs>(this, &InvalidCertificateHandler::onInvalidCertificate);
|
||||
else
|
||||
SSLManager::instance().ClientVerificationError -= Delegate<InvalidCertificateHandler, VerificationErrorArgs>(this, &InvalidCertificateHandler::onInvalidCertificate);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,7 +34,14 @@ PrivateKeyPassphraseHandler::PrivateKeyPassphraseHandler(bool onServerSide): _se
|
||||
|
||||
PrivateKeyPassphraseHandler::~PrivateKeyPassphraseHandler()
|
||||
{
|
||||
SSLManager::instance().PrivateKeyPassphraseRequired -= Delegate<PrivateKeyPassphraseHandler, std::string>(this, &PrivateKeyPassphraseHandler::onPrivateKeyRequested);
|
||||
try
|
||||
{
|
||||
SSLManager::instance().PrivateKeyPassphraseRequired -= Delegate<PrivateKeyPassphraseHandler, std::string>(this, &PrivateKeyPassphraseHandler::onPrivateKeyRequested);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,7 +69,14 @@ SSLManager::SSLManager()
|
||||
|
||||
SSLManager::~SSLManager()
|
||||
{
|
||||
shutdown();
|
||||
try
|
||||
{
|
||||
shutdown();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,7 +29,14 @@ SecureServerSocketImpl::SecureServerSocketImpl(Context::Ptr pContext):
|
||||
|
||||
SecureServerSocketImpl::~SecureServerSocketImpl()
|
||||
{
|
||||
reset();
|
||||
try
|
||||
{
|
||||
reset();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,14 @@ SecureStreamSocketImpl::SecureStreamSocketImpl(StreamSocketImpl* pStreamSocket,
|
||||
|
||||
SecureStreamSocketImpl::~SecureStreamSocketImpl()
|
||||
{
|
||||
reset();
|
||||
try
|
||||
{
|
||||
reset();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,7 +47,14 @@ public:
|
||||
|
||||
~ArchiveImpl()
|
||||
{
|
||||
close();
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& path() const
|
||||
|
@ -232,8 +232,15 @@ Timer::Timer(Poco::Thread::Priority priority)
|
||||
|
||||
Timer::~Timer()
|
||||
{
|
||||
_queue.enqueueNotification(new StopNotification(_queue), Poco::Clock(0));
|
||||
_thread.join();
|
||||
try
|
||||
{
|
||||
_queue.enqueueNotification(new StopNotification(_queue), Poco::Clock(0));
|
||||
_thread.join();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,7 +54,14 @@ Decompress::Decompress(std::istream& in, const Poco::Path& outputDir, bool flatt
|
||||
|
||||
Decompress::~Decompress()
|
||||
{
|
||||
EOk -= Poco::Delegate<Decompress, std::pair<const ZipLocalFileHeader, const Poco::Path> >(this, &Decompress::onOk);
|
||||
try
|
||||
{
|
||||
EOk -= Poco::Delegate<Decompress, std::pair<const ZipLocalFileHeader, const Poco::Path> >(this, &Decompress::onOk);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -242,7 +242,14 @@ PartialOutputStream::PartialOutputStream(std::ostream& ostr, std::size_t start,
|
||||
|
||||
PartialOutputStream::~PartialOutputStream()
|
||||
{
|
||||
close();
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user