mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-21 06:37:42 +01:00
Merge pull request #1146 from matejk/gh-860
MongoDB: disable unwanted release of resources in PooledConnection
This commit is contained in:
commit
f51cb5f6fd
@ -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;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user