diff options
author | Christian Lippka <cl@openoffice.org> | 2010-04-16 16:10:11 +0200 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2010-04-16 16:10:11 +0200 |
commit | 0d26b21b603b07aa6dba089c12e8a6c66eade60a (patch) | |
tree | 7e2c27ee84582ffff258f3f9c9f51c162423f324 /svl | |
parent | 7c05c7a3d3969846401f4856134219be3dfc1c75 (diff) |
#i108132# dispose stylesheets to avoid dangling references
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/items/style.cxx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index b8bed49b603b..60c622208d53 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -28,7 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#ifndef GCC +#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_ +#include <com/sun/star/lang/XComponent.hpp> #endif #define _SVSTDARR_STRINGS @@ -808,6 +809,16 @@ void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p ) { // Alle Styles umsetzen, deren Parent dieser hier ist ChangeParent( p->GetName(), p->GetParent() ); + + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComp( static_cast< ::cppu::OWeakObject* >((*aIter).get()), com::sun::star::uno::UNO_QUERY ); + if( xComp.is() ) try + { + xComp->dispose(); + } + catch( com::sun::star::uno::Exception& ) + { + } + aStyles.erase(aIter); Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) ); } @@ -838,6 +849,15 @@ void SfxStyleSheetBasePool::Clear() SfxStyles::iterator aIter( aClearStyles.begin() ); while( aIter != aClearStyles.end() ) { + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComp( static_cast< ::cppu::OWeakObject* >((*aIter).get()), com::sun::star::uno::UNO_QUERY ); + if( xComp.is() ) try + { + xComp->dispose(); + } + catch( com::sun::star::uno::Exception& ) + { + } + Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *(*aIter++).get() ) ); } } |