summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-24 11:02:42 +0200
committerNoel Grandin <noel@peralex.com>2016-05-24 11:02:42 +0200
commit95d20a3799998b9816bd2e8aebdbc96c61cead3e (patch)
tree8206ecc848631432cb8b027d5e780483734f808a /connectivity
parent3caf31b05d7bbf3d50a1bbda6c8b95982cb5c2b5 (diff)
Revert "remove some manual ref-counting"
until I have a better understanding of the UNO reference counting. This reverts commit 111de438ea3e512a541281dc0716cc728ea8d152.
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/dbase/DIndexIter.cxx19
-rw-r--r--connectivity/source/drivers/mork/MConnection.cxx7
-rw-r--r--connectivity/source/drivers/mork/MConnection.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.cxx10
-rw-r--r--connectivity/source/inc/dbase/DIndexIter.hxx5
5 files changed, 27 insertions, 18 deletions
diff --git a/connectivity/source/drivers/dbase/DIndexIter.cxx b/connectivity/source/drivers/dbase/DIndexIter.cxx
index 3f072f8172d1..3c0318b4c36f 100644
--- a/connectivity/source/drivers/dbase/DIndexIter.cxx
+++ b/connectivity/source/drivers/dbase/DIndexIter.cxx
@@ -30,6 +30,7 @@ using namespace connectivity::file;
OIndexIterator::~OIndexIterator()
{
+ m_pIndex->release();
}
@@ -50,7 +51,7 @@ sal_uInt32 OIndexIterator::Find(bool bFirst)
if (bFirst)
{
- m_aRoot = m_xIndex->getRoot();
+ m_aRoot = m_pIndex->getRoot();
m_aCurLeaf.Clear();
}
@@ -61,7 +62,7 @@ sal_uInt32 OIndexIterator::Find(bool bFirst)
{
ONDXPage* pPage = m_aRoot;
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_xIndex.get());
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = NODE_NOTFOUND;
@@ -107,8 +108,8 @@ ONDXKey* OIndexIterator::GetFirstKey(ONDXPage* pPage, const OOperand& rKey)
if (!pPage->IsLeaf())
{
// descend further
- ONDXPagePtr aPage = (i==0) ? pPage->GetChild(m_xIndex.get())
- : ((*pPage)[i-1]).GetChild(m_xIndex.get(), pPage);
+ ONDXPagePtr aPage = (i==0) ? pPage->GetChild(m_pIndex)
+ : ((*pPage)[i-1]).GetChild(m_pIndex, pPage);
pFoundKey = aPage.Is() ? GetFirstKey(aPage, rKey) : nullptr;
}
else if (i == pPage->Count())
@@ -143,7 +144,7 @@ sal_uInt32 OIndexIterator::GetCompare(bool bFirst)
case SQLFilterOperator::LESS:
case SQLFilterOperator::LESS_EQUAL:
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_xIndex.get());
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = NODE_NOTFOUND;
@@ -205,7 +206,7 @@ sal_uInt32 OIndexIterator::GetLike(bool bFirst)
ONDXPage* pPage = m_aRoot;
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_xIndex.get());
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = NODE_NOTFOUND;
@@ -224,7 +225,7 @@ sal_uInt32 OIndexIterator::GetNull(bool bFirst)
{
ONDXPage* pPage = m_aRoot;
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_xIndex.get());
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = NODE_NOTFOUND;
@@ -273,7 +274,7 @@ ONDXKey* OIndexIterator::GetNextKey()
sal_uInt16 nPos = pParentPage->Search(pPage);
if (nPos != pParentPage->Count() - 1)
{ // page found
- pPage = (*pParentPage)[nPos+1].GetChild(m_xIndex.get(),pParentPage);
+ pPage = (*pParentPage)[nPos+1].GetChild(m_pIndex,pParentPage);
break;
}
}
@@ -282,7 +283,7 @@ ONDXKey* OIndexIterator::GetNextKey()
// now go on with leaf
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_xIndex.get());
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = 0;
diff --git a/connectivity/source/drivers/mork/MConnection.cxx b/connectivity/source/drivers/mork/MConnection.cxx
index 84722b594564..633f84e3011f 100644
--- a/connectivity/source/drivers/mork/MConnection.cxx
+++ b/connectivity/source/drivers/mork/MConnection.cxx
@@ -40,9 +40,10 @@ static const int defaultScope = 0x80;
OConnection::OConnection(MorkDriver* _pDriver)
:OSubComponent<OConnection, OConnection_BASE>(static_cast<cppu::OWeakObject*>(_pDriver), this)
- ,m_xDriver(_pDriver)
+ ,m_pDriver(_pDriver)
,m_aColumnAlias( _pDriver->getFactory() )
{
+ m_pDriver->acquire();
m_pBook = new MorkParser();
m_pHistory = new MorkParser();
}
@@ -51,6 +52,8 @@ OConnection::~OConnection()
{
if(!isClosed())
close();
+ m_pDriver->release();
+ m_pDriver = nullptr;
delete m_pBook;
delete m_pHistory;
}
@@ -109,7 +112,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
// production?
if (unittestIndex == -1)
{
- OUString path = m_xDriver->getProfilePath();
+ OUString path = m_pDriver->getProfilePath();
SAL_INFO("connectivity.mork", "ProfilePath: " << path);
abook = path + "/abook.mab";
history = path + "/history.mab";
diff --git a/connectivity/source/drivers/mork/MConnection.hxx b/connectivity/source/drivers/mork/MConnection.hxx
index e573d057aafd..3654b6926085 100644
--- a/connectivity/source/drivers/mork/MConnection.hxx
+++ b/connectivity/source/drivers/mork/MConnection.hxx
@@ -37,7 +37,7 @@ namespace connectivity
// Data attributes
- css::uno::Reference<MorkDriver> m_xDriver; // Pointer to the owning
+ MorkDriver* m_pDriver; // Pointer to the owning
// driver object
OColumnAlias m_aColumnAlias;
// Mork Parser (abook)
@@ -52,7 +52,7 @@ namespace connectivity
explicit OConnection(MorkDriver* const driver);
virtual ~OConnection();
- const css::uno::Reference<MorkDriver>& getDriver() {return m_xDriver;};
+ MorkDriver* getDriver() {return m_pDriver;};
MorkParser* getMorkParser(const OString& t) {return t == "CollectedAddressBook" ? m_pHistory : m_pBook;};
// OComponentHelper
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 214f08c47b7d..ebe1aaac52f2 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -96,24 +96,28 @@ namespace pq_sdbc_driver
// Helper class for statement lifetime management
class ClosableReference : public cppu::WeakImplHelper< com::sun::star::uno::XReference >
{
- css::uno::Reference<Connection> m_conn;
+ Connection *m_conn;
::rtl::ByteSequence m_id;
public:
ClosableReference( const ::rtl::ByteSequence & id , Connection *that )
: m_conn( that ), m_id( id )
{
+ that->acquire();
}
virtual ~ClosableReference()
{
+ if( m_conn )
+ m_conn->release();
}
virtual void SAL_CALL dispose() throw (std::exception) override
{
- if( m_conn.is() )
+ if( m_conn )
{
m_conn->removeFromWeakMap(m_id);
- m_conn.clear();
+ m_conn->release();
+ m_conn = nullptr;
}
}
};
diff --git a/connectivity/source/inc/dbase/DIndexIter.hxx b/connectivity/source/inc/dbase/DIndexIter.hxx
index 7b950fdd0923..0b70f96e0c25 100644
--- a/connectivity/source/inc/dbase/DIndexIter.hxx
+++ b/connectivity/source/inc/dbase/DIndexIter.hxx
@@ -36,7 +36,7 @@ namespace connectivity
protected:
file::OBoolOperator* m_pOperator;
const file::OOperand* m_pOperand;
- css::uno::Reference<ODbaseIndex> m_xIndex;
+ ODbaseIndex* m_pIndex;
ONDXPagePtr m_aRoot,
m_aCurLeaf;
sal_uInt16 m_nCurNode;
@@ -57,9 +57,10 @@ namespace connectivity
const file::OOperand* pOper)
:m_pOperator(pOp)
,m_pOperand(pOper)
- ,m_xIndex(pInd)
+ ,m_pIndex(pInd)
,m_nCurNode(NODE_NOTFOUND)
{
+ pInd->acquire();
}
virtual ~OIndexIterator();