Merge pull request #1146 from matejk/gh-860

MongoDB: disable unwanted release of resources in PooledConnection
This commit is contained in:
Aleksandar Fabijanic 2016-05-05 12:42:44 -05:00
commit f51cb5f6fd

View File

@ -86,7 +86,10 @@ public:
{
try
{
_pool.returnObject(_connection);
if (_connection)
{
_pool.returnObject(_connection);
}
}
catch (...)
{
@ -99,7 +102,24 @@ public:
return _connection;
}
#if defined(POCO_ENABLE_CPP11)
// Disable copy to prevent unwanted release of resources: C++11 way
PooledConnection(const PooledConnection&) = delete;
PooledConnection& operator=(const PooledConnection&) = delete;
// Enable move semantics
PooledConnection(PooledConnection&& other) = default;
PooledConnection& operator=(PooledConnection&&) = default;
#endif
private:
#if ! defined(POCO_ENABLE_CPP11)
// Disable copy to prevent unwanted release of resources: pre C++11 way
PooledConnection(const PooledConnection&);
PooledConnection& operator=(const PooledConnection&);
#endif
Poco::ObjectPool<Connection, Connection::Ptr>& _pool;
Connection::Ptr _connection;
};