From d7d6b739a2bc7f92fb420e085a36c21f48f377ca Mon Sep 17 00:00:00 2001 From: Iskandar Safarov Date: Mon, 3 Jul 2017 04:04:58 +1000 Subject: [PATCH] Exception in destructor (#1777) * The destructor of BasicBufferedStreamBuf() calls Allocator::deallocate which can throw exceptions. In particular it throws Poco::SystemException when can't lock mutex. * Added poco_unexpected(); into exception handler --- Foundation/include/Poco/BufferedStreamBuf.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Foundation/include/Poco/BufferedStreamBuf.h b/Foundation/include/Poco/BufferedStreamBuf.h index 8817005dd..31b960464 100644 --- a/Foundation/include/Poco/BufferedStreamBuf.h +++ b/Foundation/include/Poco/BufferedStreamBuf.h @@ -67,7 +67,13 @@ public: ~BasicBufferedStreamBuf() { - Allocator::deallocate(_pBuffer, _bufsize); + try + { + Allocator::deallocate(_pBuffer, _bufsize); + } catch (...) + { + poco_unexpected(); + } } virtual int_type overflow(int_type c)