summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-04-05 13:09:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-04-05 13:59:07 +0100
commit47bc24a6bf5074c59d2f2a6bef79e5e70c842889 (patch)
treeaa5d1981e371f33e1f56ce1d05901b30a527b096 /stoc
parent01028864214a1b1ee6bf3f00fca142baf7b1d40c (diff)
Resolves: fdo#47068 use of pointer to deleted object
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/inspect/introspection.cxx82
1 files changed, 46 insertions, 36 deletions
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index a1f239f84084..1b57eb7de563 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -712,9 +712,6 @@ class ImplIntrospectionAdapter :
public XEnumerationAccess, public XIdlArray,
public OWeakObject
{
- // Parent-Objekt
- ImplIntrospectionAccess* mpAccess;
-
// Untersuchtes Objekt
const Any& mrInspectedObject;
@@ -734,8 +731,7 @@ class ImplIntrospectionAdapter :
Reference<XIdlArray> mxObjIdlArray;
public:
- ImplIntrospectionAdapter( ImplIntrospectionAccess* pAccess_,
- const Any& obj,
+ ImplIntrospectionAdapter( const Any& obj,
rtl::Reference< IntrospectionAccessStatic_Impl > const & pStaticImpl_ );
// Methoden von XInterface
@@ -813,10 +809,9 @@ public:
throw( IllegalArgumentException, ArrayIndexOutOfBoundsException, RuntimeException );
};
-ImplIntrospectionAdapter::ImplIntrospectionAdapter( ImplIntrospectionAccess* pAccess_,
- const Any& obj,
+ImplIntrospectionAdapter::ImplIntrospectionAdapter(const Any& obj,
rtl::Reference< IntrospectionAccessStatic_Impl > const & pStaticImpl_ )
- : mpAccess( pAccess_), mrInspectedObject( obj ), mpStaticImpl( pStaticImpl_ )
+ : mrInspectedObject( obj ), mpStaticImpl( pStaticImpl_ )
{
// Objekt als Interfaceholen
TypeClass eType = mrInspectedObject.getValueType().getTypeClass();
@@ -1035,16 +1030,54 @@ Sequence< Property > ImplIntrospectionAdapter::getProperties(void) throw( Runtim
return mpStaticImpl->getProperties();
}
+namespace
+{
+ Property getPropertyImpl(IntrospectionAccessStatic_Impl *pStaticImpl, const OUString& Name, sal_Int32 PropertyConcepts)
+ throw( NoSuchElementException, RuntimeException )
+ {
+ Property aRet;
+ sal_Int32 i = pStaticImpl->getPropertyIndex( Name );
+ sal_Bool bFound = sal_False;
+ if( i != -1 )
+ {
+ sal_Int32 nConcept = pStaticImpl->getPropertyConcepts().getConstArray()[ i ];
+ if( (PropertyConcepts & nConcept) != 0 )
+ {
+ const Property* pProps = pStaticImpl->getProperties().getConstArray();
+ aRet = pProps[ i ];
+ bFound = sal_True;
+ }
+ }
+ if( !bFound )
+ throw NoSuchElementException() ;
+ return aRet;
+ }
+
+ sal_Bool hasPropertyImpl(IntrospectionAccessStatic_Impl *pStaticImpl, const OUString& Name, sal_Int32 PropertyConcepts)
+ throw( RuntimeException )
+ {
+ sal_Int32 i = pStaticImpl->getPropertyIndex( Name );
+ sal_Bool bRet = sal_False;
+ if( i != -1 )
+ {
+ sal_Int32 nConcept = pStaticImpl->getPropertyConcepts().getConstArray()[ i ];
+ if( (PropertyConcepts & nConcept) != 0 )
+ bRet = sal_True;
+ }
+ return bRet;
+ }
+}
+
Property ImplIntrospectionAdapter::getPropertyByName(const OUString& Name)
throw( RuntimeException )
{
- return mpAccess->getProperty( Name, PropertyConcept::ALL );
+ return getPropertyImpl(mpStaticImpl.get(), Name, PropertyConcept::ALL);
}
sal_Bool ImplIntrospectionAdapter::hasPropertyByName(const OUString& Name)
throw( RuntimeException )
{
- return mpAccess->hasProperty( Name, PropertyConcept::ALL );
+ return hasPropertyImpl(mpStaticImpl.get(), Name, PropertyConcept::ALL);
}
// Methoden von XElementAccess
@@ -1189,36 +1222,13 @@ sal_Int32 ImplIntrospectionAccess::getSuppliedPropertyConcepts(void)
Property ImplIntrospectionAccess::getProperty(const OUString& Name, sal_Int32 PropertyConcepts)
throw( NoSuchElementException, RuntimeException )
{
- Property aRet;
- sal_Int32 i = mpStaticImpl->getPropertyIndex( Name );
- sal_Bool bFound = sal_False;
- if( i != -1 )
- {
- sal_Int32 nConcept = mpStaticImpl->getPropertyConcepts().getConstArray()[ i ];
- if( (PropertyConcepts & nConcept) != 0 )
- {
- const Property* pProps = mpStaticImpl->getProperties().getConstArray();
- aRet = pProps[ i ];
- bFound = sal_True;
- }
- }
- if( !bFound )
- throw NoSuchElementException() ;
- return aRet;
+ return getPropertyImpl(mpStaticImpl.get(), Name, PropertyConcepts);
}
sal_Bool ImplIntrospectionAccess::hasProperty(const OUString& Name, sal_Int32 PropertyConcepts)
throw( RuntimeException )
{
- sal_Int32 i = mpStaticImpl->getPropertyIndex( Name );
- sal_Bool bRet = sal_False;
- if( i != -1 )
- {
- sal_Int32 nConcept = mpStaticImpl->getPropertyConcepts().getConstArray()[ i ];
- if( (PropertyConcepts & nConcept) != 0 )
- bRet = sal_True;
- }
- return bRet;
+ return hasPropertyImpl(mpStaticImpl.get(), Name, PropertyConcepts);
}
Sequence< Property > ImplIntrospectionAccess::getProperties(sal_Int32 PropertyConcepts)
@@ -1405,7 +1415,7 @@ Reference<XInterface> SAL_CALL ImplIntrospectionAccess::queryAdapter( const Type
if( !mpAdapter.is() )
{
((ImplIntrospectionAccess*)this)->mpAdapter =
- new ImplIntrospectionAdapter( this, maInspectedObject, mpStaticImpl );
+ new ImplIntrospectionAdapter( maInspectedObject, mpStaticImpl );
}
Reference<XInterface> xRet;