Author: hdu Date: Tue Jan 29 09:58:11 2013 New Revision: 1439808 URL: http://svn.apache.org/viewvc?rev=1439808&view=rev Log: 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 Modified: openoffice/trunk/main/cppu/inc/com/sun/star/uno/Reference.hxx Modified: openoffice/trunk/main/cppu/inc/com/sun/star/uno/Reference.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/cppu/inc/com/sun/star/uno/Reference.hxx?rev=1439808&r1=1439807&r2=1439808&view=diff ============================================================================== --- openoffice/trunk/main/cppu/inc/com/sun/star/uno/Reference.hxx (original) +++ openoffice/trunk/main/cppu/inc/com/sun/star/uno/Reference.hxx Tue Jan 29 09:58:11 2013 @@ -171,18 +171,21 @@ inline Reference< interface_type >::Refe 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 >::Refe 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