Kaydet (Commit) baede5e8 authored tarafından Caolán McNamara's avatar Caolán McNamara

ensure that osl_atomic_decrement gets called after osl_atomic_increment

Change-Id: If110d27950a4efd1a96dc5f2702f4dfbfe58bcbe
üst e01a142c
......@@ -106,10 +106,24 @@ void SAL_CALL Connection::release() throw()
relase_ChildImpl();
}
struct ConnectionGuard
{
oslInterlockedCount& m_refCount;
ConnectionGuard(oslInterlockedCount& refCount)
: m_refCount(refCount)
{
osl_atomic_increment(&m_refCount);
}
~ConnectionGuard()
{
osl_atomic_decrement(&m_refCount);
}
};
void Connection::construct(const ::rtl::OUString& url, const Sequence< PropertyValue >& info)
throw (SQLException, RuntimeException, std::exception)
{
osl_atomic_increment( &m_refCount );
ConnectionGuard aGuard(m_refCount);
try
{
......@@ -308,8 +322,6 @@ void Connection::construct(const ::rtl::OUString& url, const Sequence< PropertyV
{
throw std::runtime_error("Generic Firebird::Exception");
}
osl_atomic_decrement( &m_refCount );
}
void Connection::notifyDatabaseModified()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment