diff options
author | Herbert Dürr <hdu@apache.org> | 2013-01-29 08:58:11 +0000 |
---|---|---|
committer | Herbert Dürr <hdu@apache.org> | 2013-01-29 08:58:11 +0000 |
commit | 8483543d9db7010a9fe80b815e8957640d190814 (patch) | |
tree | 8ba2e77512c2b5f119fc29a770ec0bfc44fcfb4e /cppu/inc | |
parent | c90a6ca92b1239d01a2892e15488e4a183a88b1a (diff) |
fix css::uno's throwing Reference constructors
The destructor of the Reference class depends on its _pInterface member being set,
but some constructors skip this when an exception was thrown. Always initializing
them properly while avoiding a rethrow is cheap and safe.
Fixed-By: Herbert Dürr, Andre Fischer
Notes
Notes:
reject: if the ctor throws, the dtor is not called anyway
Diffstat (limited to 'cppu/inc')
-rw-r--r-- | cppu/inc/com/sun/star/uno/Reference.hxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cppu/inc/com/sun/star/uno/Reference.hxx b/cppu/inc/com/sun/star/uno/Reference.hxx index 24ec8ca4f053..d1df31156455 100644 --- a/cppu/inc/com/sun/star/uno/Reference.hxx +++ b/cppu/inc/com/sun/star/uno/Reference.hxx @@ -171,18 +171,21 @@ inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_Qu template< class interface_type > inline Reference< interface_type >::Reference( const BaseReference & rRef, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ) { + _pInterface = NULL; _pInterface = iquery_throw( rRef.get() ); } //__________________________________________________________________________________________________ template< class interface_type > inline Reference< interface_type >::Reference( XInterface * pInterface, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ) { + _pInterface = NULL; _pInterface = iquery_throw( pInterface ); } //__________________________________________________________________________________________________ template< class interface_type > inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ) { + _pInterface = NULL; _pInterface = iquery_throw( typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass ? static_cast< XInterface * >( rAny.pReserved ) : 0 ); } @@ -190,12 +193,14 @@ inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_Qu template< class interface_type > inline Reference< interface_type >::Reference( const Reference< interface_type > & rRef, UnoReference_SetThrow ) SAL_THROW( (RuntimeException) ) { + _pInterface = NULL; _pInterface = iset_throw( rRef.get() ); } //__________________________________________________________________________________________________ template< class interface_type > inline Reference< interface_type >::Reference( interface_type * pInterface, UnoReference_SetThrow ) SAL_THROW( (RuntimeException) ) { + _pInterface = NULL; _pInterface = iset_throw( pInterface ); } #endif |