Kaydet (Commit) 089311bb authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Petr Mladek

coverity#704145 Resource leak in object

also cleaned up comments

Change-Id: Ia676d215cf8ef4830e31a1caf4153e33af84c200
Reviewed-on: https://gerrit.libreoffice.org/3071Reviewed-by: 's avatarPetr Mladek <pmladek@suse.cz>
Tested-by: 's avatarPetr Mladek <pmladek@suse.cz>
üst a756c885
...@@ -24,10 +24,8 @@ ...@@ -24,10 +24,8 @@
#include <sal/types.h> #include <sal/types.h>
#include <svl/poolitem.hxx> #include <svl/poolitem.hxx>
//........................................................................
namespace frm namespace frm
{ {
//........................................................................
//==================================================================== //====================================================================
//= misc //= misc
...@@ -62,10 +60,10 @@ namespace frm ...@@ -62,10 +60,10 @@ namespace frm
public: public:
AttributeCheckState eSimpleState; AttributeCheckState eSimpleState;
//................................................................
inline AttributeState( ); inline AttributeState( );
inline explicit AttributeState( AttributeCheckState _eCheckState ); inline explicit AttributeState( AttributeCheckState _eCheckState );
inline AttributeState( const AttributeState& _rSource ); inline AttributeState( const AttributeState& _rSource );
inline ~AttributeState( );
inline AttributeState& operator=( const AttributeState& _rSource ); inline AttributeState& operator=( const AttributeState& _rSource );
...@@ -78,21 +76,18 @@ namespace frm ...@@ -78,21 +76,18 @@ namespace frm
//==================================================================== //====================================================================
//= AttributeState (inline implementation) //= AttributeState (inline implementation)
//==================================================================== //====================================================================
//................................................................
inline AttributeState::AttributeState( ) inline AttributeState::AttributeState( )
:pItemHandle( NULL ) :pItemHandle( NULL )
,eSimpleState( eIndetermined ) ,eSimpleState( eIndetermined )
{ {
} }
//................................................................
inline AttributeState::AttributeState( AttributeCheckState _eCheckState ) inline AttributeState::AttributeState( AttributeCheckState _eCheckState )
:pItemHandle( NULL ) :pItemHandle( NULL )
,eSimpleState( _eCheckState ) ,eSimpleState( _eCheckState )
{ {
} }
//................................................................
inline AttributeState::AttributeState( const AttributeState& _rSource ) inline AttributeState::AttributeState( const AttributeState& _rSource )
:pItemHandle( NULL ) :pItemHandle( NULL )
,eSimpleState( eIndetermined ) ,eSimpleState( eIndetermined )
...@@ -100,7 +95,11 @@ namespace frm ...@@ -100,7 +95,11 @@ namespace frm
operator=( _rSource ); operator=( _rSource );
} }
//................................................................ inline AttributeState::~AttributeState( )
{
delete(pItemHandle);
}
inline AttributeState& AttributeState::operator=( const AttributeState& _rSource ) inline AttributeState& AttributeState::operator=( const AttributeState& _rSource )
{ {
if ( &_rSource == this ) if ( &_rSource == this )
...@@ -111,13 +110,11 @@ namespace frm ...@@ -111,13 +110,11 @@ namespace frm
return *this; return *this;
} }
//................................................................
inline const SfxPoolItem* AttributeState::getItem() const inline const SfxPoolItem* AttributeState::getItem() const
{ {
return pItemHandle ? &pItemHandle->GetItem() : NULL; return pItemHandle ? &pItemHandle->GetItem() : NULL;
} }
//................................................................
inline void AttributeState::setItem( const SfxPoolItem* _pItem ) inline void AttributeState::setItem( const SfxPoolItem* _pItem )
{ {
if ( pItemHandle ) if ( pItemHandle )
...@@ -128,7 +125,6 @@ namespace frm ...@@ -128,7 +125,6 @@ namespace frm
pItemHandle = NULL; pItemHandle = NULL;
} }
//................................................................
inline bool AttributeState::operator==( const AttributeState& _rRHS ) inline bool AttributeState::operator==( const AttributeState& _rRHS )
{ {
if ( eSimpleState != _rRHS.eSimpleState ) if ( eSimpleState != _rRHS.eSimpleState )
...@@ -159,9 +155,7 @@ namespace frm ...@@ -159,9 +155,7 @@ namespace frm
~IMultiAttributeDispatcher() {} ~IMultiAttributeDispatcher() {}
}; };
//........................................................................
} // namespace frm } // namespace frm
//........................................................................
#endif // FORMS_SOURCE_RICHTEXT_RTATTRIBUTES_HXX #endif // FORMS_SOURCE_RICHTEXT_RTATTRIBUTES_HXX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment