summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2011-09-09 09:45:14 +0200
committerStephan Bergmann <sbergman@redhat.com>2011-09-09 17:46:35 +0200
commitbb157a42865a2d591f378577c4cfb7c731e18a08 (patch)
tree0f95f2cb826f37e84abaecc0cf860d808feb6944 /framework
parent390eaa736364a59e479a849598677b1a6a87f24e (diff)
sb140: #i116785# avoid ring-ref that keeps ref counted objects alive forever
improves over similar dbd2b6037046f0ecaa9a052ebf7c0fa84026968a "fix circular depend"
Diffstat (limited to 'framework')
-rw-r--r--framework/source/uiconfiguration/imagemanager.cxx14
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.cxx22
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.hxx14
-rw-r--r--framework/source/uiconfiguration/moduleimagemanager.cxx14
4 files changed, 29 insertions, 35 deletions
diff --git a/framework/source/uiconfiguration/imagemanager.cxx b/framework/source/uiconfiguration/imagemanager.cxx
index ba0b7fea77da..be7f16705d6c 100644
--- a/framework/source/uiconfiguration/imagemanager.cxx
+++ b/framework/source/uiconfiguration/imagemanager.cxx
@@ -109,7 +109,7 @@ DEFINE_INIT_SERVICE ( ImageManager, {} )
ImageManager::ImageManager( uno::Reference< XMultiServiceFactory > xServiceManager ) :
ThreadHelpBase( &Application::GetSolarMutex() )
- , m_pImpl( new ImageManagerImpl(xServiceManager,this,false) )
+ , m_pImpl( new ImageManagerImpl(xServiceManager,false) )
{
}
@@ -121,7 +121,7 @@ ImageManager::~ImageManager()
// XComponent
void SAL_CALL ImageManager::dispose() throw (::com::sun::star::uno::RuntimeException)
{
- m_pImpl->dispose();
+ m_pImpl->dispose(static_cast< OWeakObject* >(this));
}
void SAL_CALL ImageManager::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
@@ -157,7 +157,7 @@ throw (::com::sun::star::uno::RuntimeException)
{
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- m_pImpl->reset();
+ m_pImpl->reset(static_cast< OWeakObject* >(this));
}
Sequence< ::rtl::OUString > SAL_CALL ImageManager::getAllImageNames( ::sal_Int16 nImageType )
@@ -188,7 +188,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
+ m_pImpl->replaceImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence,aGraphicsSequence);
}
void SAL_CALL ImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
@@ -196,7 +196,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- m_pImpl->removeImages(nImageType,aCommandURLSequence);
+ m_pImpl->removeImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence);
}
void SAL_CALL ImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
@@ -205,7 +205,7 @@ throw ( ::com::sun::star::container::ElementExistException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
+ m_pImpl->insertImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence,aGraphicSequence);
}
// XUIConfiguration
@@ -227,7 +227,7 @@ void SAL_CALL ImageManager::reload()
throw ( ::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException )
{
- m_pImpl->reload();
+ m_pImpl->reload(static_cast< OWeakObject* >(this));
}
void SAL_CALL ImageManager::store()
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 9ab06fe0875e..f5e6f5681c3d 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -690,10 +690,9 @@ CmdImageList* ImageManagerImpl::implts_getDefaultImageList()
return m_pDefaultImageList;
}
-ImageManagerImpl::ImageManagerImpl( const uno::Reference< XMultiServiceFactory >& xServiceManager,::cppu::OWeakObject* pOwner,bool _bUseGlobal ) :
+ImageManagerImpl::ImageManagerImpl( const uno::Reference< XMultiServiceFactory >& xServiceManager,bool _bUseGlobal ) :
ThreadHelpBase( &Application::GetSolarMutex() )
, m_xServiceManager( xServiceManager )
- , m_pOwner(pOwner)
, m_pDefaultImageList( 0 )
, m_aXMLPostfix( RTL_CONSTASCII_USTRINGPARAM( ".xml" ))
, m_aResourceString( RTL_CONSTASCII_USTRINGPARAM( ModuleImageList ))
@@ -717,9 +716,8 @@ ImageManagerImpl::~ImageManagerImpl()
clear();
}
-void ImageManagerImpl::dispose()
+void ImageManagerImpl::dispose( const uno::Reference< XInterface >& xOwner )
{
- uno::Reference< uno::XInterface > xOwner(static_cast< OWeakObject* >(m_pOwner));
css::lang::EventObject aEvent( xOwner );
m_aListenerContainer.disposeAndClear( aEvent );
@@ -807,7 +805,7 @@ void ImageManagerImpl::initialize( const Sequence< Any >& aArguments )
}
// XImageManagerImpl
-void ImageManagerImpl::reset()
+void ImageManagerImpl::reset( const uno::Reference< XInterface >& xOwner )
throw (::com::sun::star::uno::RuntimeException)
{
ResetableGuard aLock( m_aLock );
@@ -830,7 +828,7 @@ throw (::com::sun::star::uno::RuntimeException)
aRemoveList[j] = aUserImageNames[j];
// Remove images
- removeImages( sal_Int16( i ), aRemoveList );
+ removeImages( xOwner, sal_Int16( i ), aRemoveList );
m_bUserImageListModified[i] = true;
}
@@ -962,6 +960,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno:
}
void ImageManagerImpl::replaceImages(
+ const uno::Reference< XInterface >& xOwner,
::sal_Int16 nImageType,
const Sequence< ::rtl::OUString >& aCommandURLSequence,
const Sequence< uno::Reference< XGraphic > >& aGraphicsSequence )
@@ -1020,7 +1019,6 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
}
}
- uno::Reference< uno::XInterface > xOwner(static_cast< OWeakObject* >(m_pOwner));
// Notify listeners
if ( pInsertedImages != 0 )
{
@@ -1047,7 +1045,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
}
}
-void ImageManagerImpl::removeImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
+void ImageManagerImpl::removeImages( const uno::Reference< XInterface >& xOwner, ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
@@ -1125,7 +1123,6 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
}
// Notify listeners
- uno::Reference< uno::XInterface > xOwner(static_cast< OWeakObject* >(m_pOwner));
if ( pRemovedImages != 0 )
{
ConfigurationEvent aRemoveEvent;
@@ -1151,18 +1148,18 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
}
}
-void ImageManagerImpl::insertImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
+void ImageManagerImpl::insertImages( const uno::Reference< XInterface >& xOwner, ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
throw ( ::com::sun::star::container::ElementExistException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- replaceImages(nImageType,aCommandURLSequence,aGraphicSequence);
+ replaceImages(xOwner,nImageType,aCommandURLSequence,aGraphicSequence);
}
// XUIConfigurationPersistence
-void ImageManagerImpl::reload()
+void ImageManagerImpl::reload( const uno::Reference< XInterface >& xOwner )
throw ( ::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException )
{
@@ -1271,7 +1268,6 @@ throw ( ::com::sun::star::uno::Exception,
aGuard.unlock();
// Now notify our listeners. Unlock mutex to prevent deadlocks
- uno::Reference< uno::XInterface > xOwner(static_cast< OWeakObject* >(m_pOwner));
if ( pInsertedImages != 0 )
{
ConfigurationEvent aInsertEvent;
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.hxx b/framework/source/uiconfiguration/imagemanagerimpl.hxx
index 4e6d123c3211..754579de3be8 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.hxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.hxx
@@ -131,30 +131,29 @@ namespace framework
public:
ImageManagerImpl(const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager
- ,::cppu::OWeakObject *pOwner
,bool _bUseGlobal);
~ImageManagerImpl();
- void dispose();
+ void dispose( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xOwner );
void initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
void addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
void removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
// XImageManager
- void reset() throw (::com::sun::star::uno::RuntimeException);
+ void reset( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xOwner ) throw (::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Sequence< ::rtl::OUString > getAllImageNames( ::sal_Int16 nImageType ) throw (::com::sun::star::uno::RuntimeException);
::sal_Bool hasImage( ::sal_Int16 nImageType, const ::rtl::OUString& aCommandURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > getImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- void replaceImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& aGraphicsSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
- void removeImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aResourceURLSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
- void insertImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& aGraphicSequence ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
+ void replaceImages( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xOwner, ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& aGraphicsSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
+ void removeImages( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xOwner, ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aResourceURLSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
+ void insertImages( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xOwner, ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& aGraphicSequence ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
// XUIConfiguration
void addConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
void removeConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
// XUIConfigurationPersistence
- void reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ void reload( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xOwner ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
void store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
void storeToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
sal_Bool isModified() throw (::com::sun::star::uno::RuntimeException);
@@ -202,7 +201,6 @@ namespace framework
com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserBitmapsStorage;
com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit;
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ::cppu::OWeakObject* m_pOwner;
rtl::Reference< GlobalImageList > m_pGlobalImageList;
CmdImageList* m_pDefaultImageList;
rtl::OUString m_aXMLPostfix;
diff --git a/framework/source/uiconfiguration/moduleimagemanager.cxx b/framework/source/uiconfiguration/moduleimagemanager.cxx
index 4273e86850c8..f96746a25bdb 100644
--- a/framework/source/uiconfiguration/moduleimagemanager.cxx
+++ b/framework/source/uiconfiguration/moduleimagemanager.cxx
@@ -94,7 +94,7 @@ namespace framework
{
ModuleImageManager::ModuleImageManager( uno::Reference< XMultiServiceFactory > xServiceManager ) :
ThreadHelpBase( &Application::GetSolarMutex() )
- , m_pImpl( new ImageManagerImpl(xServiceManager,static_cast< OWeakObject* >(this),true) )
+ , m_pImpl( new ImageManagerImpl(xServiceManager,true) )
{
}
@@ -105,7 +105,7 @@ ModuleImageManager::~ModuleImageManager()
// XComponent
void SAL_CALL ModuleImageManager::dispose() throw (::com::sun::star::uno::RuntimeException)
{
- m_pImpl->dispose();
+ m_pImpl->dispose(static_cast< OWeakObject* >(this));
}
void SAL_CALL ModuleImageManager::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
@@ -129,7 +129,7 @@ void SAL_CALL ModuleImageManager::initialize( const Sequence< Any >& aArguments
void SAL_CALL ModuleImageManager::reset()
throw (::com::sun::star::uno::RuntimeException)
{
- m_pImpl->reset();
+ m_pImpl->reset(static_cast< OWeakObject* >(this));
}
Sequence< ::rtl::OUString > SAL_CALL ModuleImageManager::getAllImageNames( ::sal_Int16 nImageType )
@@ -161,7 +161,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
+ m_pImpl->replaceImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence,aGraphicsSequence);
}
void SAL_CALL ModuleImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
@@ -169,7 +169,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- m_pImpl->removeImages(nImageType,aCommandURLSequence);
+ m_pImpl->removeImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence);
}
void SAL_CALL ModuleImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
@@ -178,7 +178,7 @@ throw ( ::com::sun::star::container::ElementExistException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
+ m_pImpl->insertImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence,aGraphicSequence);
}
// XUIConfiguration
@@ -199,7 +199,7 @@ void SAL_CALL ModuleImageManager::reload()
throw ( ::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException )
{
- m_pImpl->reload();
+ m_pImpl->reload(static_cast< OWeakObject* >(this));
}
void SAL_CALL ModuleImageManager::store()