Kaydet (Commit) d8845ef0 authored tarafından Michael Meeks's avatar Michael Meeks

Revert "sb140: #i116785# avoid ring-ref that keeps ref counted objects alive forever"

This reverts commit bb157a42.
üst dbf239dd
......@@ -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()
......
......@@ -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;
......
......@@ -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;
......
......@@ -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()
......
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