From d147ade33489509818c1a3f8cfd887a4a896381d Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Mon, 4 Jun 2012 17:40:30 +0200 Subject: Cleanup m_xSet in destructor Change-Id: I3d7023fcb1857da1ef107a8af0d373b9ca464f03 --- dbaccess/source/core/api/KeySet.cxx | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 27b2b2866212..f2dd347d6be7 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -94,6 +94,22 @@ namespace } } } + + template < typename T > inline void tryDispose( Reference &r ) + { + try + { + ::comphelper::disposeComponent(r); + } + catch(const Exception&) + { + r = NULL; + } + catch(...) + { + OSL_FAIL("Unknown Exception occurred"); + } + } } DBG_NAME(OKeySet) @@ -124,18 +140,9 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable, OKeySet::~OKeySet() { - try - { - ::comphelper::disposeComponent(m_xStatement); - } - catch(const Exception&) - { - m_xStatement = NULL; - } - catch(...) - { - OSL_FAIL("Unknown Exception occurred"); - } + tryDispose(m_xStatement); + tryDispose(m_xSet); + m_xComposer = NULL; DBG_DTOR(OKeySet,NULL); -- cgit