summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-11-13 12:51:05 +0000
committerMichael Meeks <michael.meeks@suse.com>2012-11-15 16:06:07 +0000
commitd8845ef02f76801f270f936411ce6b36f8caaca8 (patch)
tree6fc6ec88b5399b3ccf0a176b98161053adb83448 /framework
parentdbf239ddda094a43de2e052db72de232d89f214c (diff)
Revert "sb140: #i116785# avoid ring-ref that keeps ref counted objects alive forever"
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, 35 insertions, 29 deletions
diff --git a/framework/source/uiconfiguration/imagemanager.cxx b/framework/source/uiconfiguration/imagemanager.cxx
index e6912d99be60..3e7b0fecd4c6 100644
--- a/framework/source/uiconfiguration/imagemanager.cxx
+++ b/framework/source/uiconfiguration/imagemanager.cxx
@@ -97,7 +97,7 @@ DEFINE_INIT_SERVICE ( ImageManager, {} )
ImageManager::ImageManager( uno::Reference< XMultiServiceFactory > xServiceManager ) :
ThreadHelpBase( &Application::GetSolarMutex() )
- , m_pImpl( new ImageManagerImpl(xServiceManager,false) )
+ , m_pImpl( new ImageManagerImpl(xServiceManager,this,false) )
{
}
@@ -109,7 +109,7 @@ ImageManager::~ImageManager()
// XComponent
void SAL_CALL ImageManager::dispose() throw (::com::sun::star::uno::RuntimeException)
{
- m_pImpl->dispose(static_cast< OWeakObject* >(this));
+ m_pImpl->dispose();
}
void SAL_CALL ImageManager::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
@@ -145,7 +145,7 @@ throw (::com::sun::star::uno::RuntimeException)
{
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- m_pImpl->reset(static_cast< OWeakObject* >(this));
+ m_pImpl->reset();
}
Sequence< ::rtl::OUString > SAL_CALL ImageManager::getAllImageNames( ::sal_Int16 nImageType )
@@ -176,7 +176,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- m_pImpl->replaceImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence,aGraphicsSequence);
+ m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
}
void SAL_CALL ImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
@@ -184,7 +184,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- m_pImpl->removeImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence);
+ m_pImpl->removeImages(nImageType,aCommandURLSequence);
}
void SAL_CALL ImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
@@ -193,7 +193,7 @@ throw ( ::com::sun::star::container::ElementExistException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- m_pImpl->insertImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence,aGraphicSequence);
+ m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
}
// XUIConfiguration
@@ -215,7 +215,7 @@ void SAL_CALL ImageManager::reload()
throw ( ::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException )
{
- m_pImpl->reload(static_cast< OWeakObject* >(this));
+ m_pImpl->reload();
}
void SAL_CALL ImageManager::store()
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index c6f3389b2eb9..fd0c6bf56c47 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -681,9 +681,10 @@ CmdImageList* ImageManagerImpl::implts_getDefaultImageList()
return m_pDefaultImageList;
}
-ImageManagerImpl::ImageManagerImpl( const uno::Reference< XMultiServiceFactory >& xServiceManager,bool _bUseGlobal ) :
+ImageManagerImpl::ImageManagerImpl( const uno::Reference< XMultiServiceFactory >& xServiceManager,::cppu::OWeakObject* pOwner,bool _bUseGlobal ) :
ThreadHelpBase( &Application::GetSolarMutex() )
, m_xServiceManager( xServiceManager )
+ , m_pOwner(pOwner)
, m_pDefaultImageList( 0 )
, m_aXMLPostfix( ".xml" )
, m_aResourceString( ModuleImageList )
@@ -707,8 +708,9 @@ ImageManagerImpl::~ImageManagerImpl()
clear();
}
-void ImageManagerImpl::dispose( const uno::Reference< XInterface >& xOwner )
+void ImageManagerImpl::dispose()
{
+ uno::Reference< uno::XInterface > xOwner(static_cast< OWeakObject* >(m_pOwner));
css::lang::EventObject aEvent( xOwner );
m_aListenerContainer.disposeAndClear( aEvent );
@@ -796,7 +798,7 @@ void ImageManagerImpl::initialize( const Sequence< Any >& aArguments )
}
// XImageManagerImpl
-void ImageManagerImpl::reset( const uno::Reference< XInterface >& xOwner )
+void ImageManagerImpl::reset()
throw (::com::sun::star::uno::RuntimeException)
{
ResetableGuard aLock( m_aLock );
@@ -819,7 +821,7 @@ throw (::com::sun::star::uno::RuntimeException)
aRemoveList[j] = aUserImageNames[j];
// Remove images
- removeImages( xOwner, sal_Int16( i ), aRemoveList );
+ removeImages( sal_Int16( i ), aRemoveList );
m_bUserImageListModified[i] = true;
}
@@ -951,7 +953,6 @@ 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 )
@@ -1010,6 +1011,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
}
}
+ uno::Reference< uno::XInterface > xOwner(static_cast< OWeakObject* >(m_pOwner));
// Notify listeners
if ( pInsertedImages != 0 )
{
@@ -1036,7 +1038,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
}
}
-void ImageManagerImpl::removeImages( const uno::Reference< XInterface >& xOwner, ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
+void ImageManagerImpl::removeImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
@@ -1114,6 +1116,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
}
// Notify listeners
+ uno::Reference< uno::XInterface > xOwner(static_cast< OWeakObject* >(m_pOwner));
if ( pRemovedImages != 0 )
{
ConfigurationEvent aRemoveEvent;
@@ -1139,18 +1142,18 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
}
}
-void ImageManagerImpl::insertImages( const uno::Reference< XInterface >& xOwner, ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
+void ImageManagerImpl::insertImages( ::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(xOwner,nImageType,aCommandURLSequence,aGraphicSequence);
+ replaceImages(nImageType,aCommandURLSequence,aGraphicSequence);
}
// XUIConfigurationPersistence
-void ImageManagerImpl::reload( const uno::Reference< XInterface >& xOwner )
+void ImageManagerImpl::reload()
throw ( ::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException )
{
@@ -1259,6 +1262,7 @@ 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 29eb9d03b786..a95972e8bd96 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.hxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.hxx
@@ -119,29 +119,30 @@ namespace framework
public:
ImageManagerImpl(const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager
+ ,::cppu::OWeakObject *pOwner
,bool _bUseGlobal);
~ImageManagerImpl();
- void dispose( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xOwner );
+ void dispose();
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( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xOwner ) throw (::com::sun::star::uno::RuntimeException);
+ void reset() 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( 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);
+ 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);
// 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( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xOwner ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ void reload() 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);
@@ -189,6 +190,7 @@ 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 899e20236c39..7b0fee7bbaec 100644
--- a/framework/source/uiconfiguration/moduleimagemanager.cxx
+++ b/framework/source/uiconfiguration/moduleimagemanager.cxx
@@ -84,7 +84,7 @@ namespace framework
{
ModuleImageManager::ModuleImageManager( uno::Reference< XMultiServiceFactory > xServiceManager ) :
ThreadHelpBase( &Application::GetSolarMutex() )
- , m_pImpl( new ImageManagerImpl(xServiceManager,true) )
+ , m_pImpl( new ImageManagerImpl(xServiceManager,static_cast< OWeakObject* >(this),true) )
{
}
@@ -95,7 +95,7 @@ ModuleImageManager::~ModuleImageManager()
// XComponent
void SAL_CALL ModuleImageManager::dispose() throw (::com::sun::star::uno::RuntimeException)
{
- m_pImpl->dispose(static_cast< OWeakObject* >(this));
+ m_pImpl->dispose();
}
void SAL_CALL ModuleImageManager::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
@@ -119,7 +119,7 @@ void SAL_CALL ModuleImageManager::initialize( const Sequence< Any >& aArguments
void SAL_CALL ModuleImageManager::reset()
throw (::com::sun::star::uno::RuntimeException)
{
- m_pImpl->reset(static_cast< OWeakObject* >(this));
+ m_pImpl->reset();
}
Sequence< ::rtl::OUString > SAL_CALL ModuleImageManager::getAllImageNames( ::sal_Int16 nImageType )
@@ -151,7 +151,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- m_pImpl->replaceImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence,aGraphicsSequence);
+ m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
}
void SAL_CALL ModuleImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
@@ -159,7 +159,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- m_pImpl->removeImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence);
+ m_pImpl->removeImages(nImageType,aCommandURLSequence);
}
void SAL_CALL ModuleImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
@@ -168,7 +168,7 @@ throw ( ::com::sun::star::container::ElementExistException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- m_pImpl->insertImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence,aGraphicSequence);
+ m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
}
// XUIConfiguration
@@ -189,7 +189,7 @@ void SAL_CALL ModuleImageManager::reload()
throw ( ::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException )
{
- m_pImpl->reload(static_cast< OWeakObject* >(this));
+ m_pImpl->reload();
}
void SAL_CALL ModuleImageManager::store()