Merge pull request #2193 from strk/2.3.x-no-terminate-pgis-dtor

Do not throw in postgis_datasource destruction if backend is down
This commit is contained in:
Dane Springmeyer 2014-04-04 18:20:59 -07:00
commit 7351879e6f

View file

@ -445,10 +445,19 @@ postgis_datasource::~postgis_datasource()
CnxPool_ptr pool = ConnectionManager::instance().getPool(creator_.id()); CnxPool_ptr pool = ConnectionManager::instance().getPool(creator_.id());
if (pool) if (pool)
{ {
shared_ptr<Connection> conn = pool->borrowObject(); try {
if (conn) shared_ptr<Connection> conn = pool->borrowObject();
{ if (conn)
conn->close(); {
conn->close();
}
} catch (mapnik::datasource_exception const& ex) {
// happens when borrowObject tries to
// create a new connection and fails.
// In turn, new connection would be needed
// when our broke and was thus no good to
// be borrowed
// See https://github.com/mapnik/mapnik/issues/2191
} }
} }
} }