summaryrefslogtreecommitdiff
path: root/framework/source
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2012-06-20 11:58:32 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-05-11 18:53:28 +0100
commit11f8e53d6c9942185702552445a751c6f542942d (patch)
tree5caab2fb87553099d0b5e100af6f5c9a32cf15a0 /framework/source
parent4bdbf360360bcc39929a18a4226a6ad1a22d8630 (diff)
Resolves: #i120029# Unregister on dispose.
Patch by: zhang jianfang Review by: Andre Fischer (cherry picked from commit e0d5abb649958e48660357d3fa37ab6e9707b61f) Conflicts: framework/source/uielement/toolbarmanager.cxx Change-Id: I4c6a112b27396fc7e5d42f3feef11ac1fe81efcd
Diffstat (limited to 'framework/source')
-rw-r--r--framework/source/accelerators/acceleratorconfiguration.cxx27
-rw-r--r--framework/source/accelerators/globalacceleratorconfiguration.cxx19
-rw-r--r--framework/source/accelerators/moduleacceleratorconfiguration.cxx19
-rw-r--r--framework/source/inc/accelerators/acceleratorconfiguration.hxx6
-rw-r--r--framework/source/inc/accelerators/globalacceleratorconfiguration.hxx3
-rw-r--r--framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx3
-rw-r--r--framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx3
-rw-r--r--framework/source/uielement/menubarmanager.cxx3
-rw-r--r--framework/source/uielement/toolbarmanager.cxx3
9 files changed, 84 insertions, 2 deletions
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index c2cd26cd33f8..01a43399b8dc 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -634,21 +634,23 @@ OUString XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
//-----------------------------------------------
// XInterface, XTypeProvider
-DEFINE_XINTERFACE_7(XCUBasedAcceleratorConfiguration ,
+DEFINE_XINTERFACE_8(XCUBasedAcceleratorConfiguration ,
OWeakObject ,
DIRECT_INTERFACE(css::lang::XTypeProvider ),
DIRECT_INTERFACE(css::ui::XAcceleratorConfiguration ),
DIRECT_INTERFACE(css::util::XChangesListener ),
DIRECT_INTERFACE(css::form::XReset ),
+ DIRECT_INTERFACE(css::lang::XComponent ),
DIRECT_INTERFACE(css::ui::XUIConfigurationPersistence),
DIRECT_INTERFACE(css::ui::XUIConfigurationStorage ),
DIRECT_INTERFACE(css::ui::XUIConfiguration ))
- DEFINE_XTYPEPROVIDER_7(XCUBasedAcceleratorConfiguration ,
+ DEFINE_XTYPEPROVIDER_8(XCUBasedAcceleratorConfiguration ,
css::lang::XTypeProvider ,
css::ui::XAcceleratorConfiguration ,
css::util::XChangesListener ,
css::form::XReset ,
+ css::lang::XComponent ,
css::ui::XUIConfigurationPersistence,
css::ui::XUIConfigurationStorage ,
css::ui::XUIConfiguration )
@@ -1250,6 +1252,27 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::disposing(const css::lang::Event
}
//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::dispose()
+ throw(css::uno::RuntimeException)
+{
+ // nop
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& /*xListener*/ )
+ throw(css::uno::RuntimeException)
+{
+ // nop
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& /*xListener*/ )
+ throw(css::uno::RuntimeException)
+{
+ // nop
+}
+
+//-----------------------------------------------
void XCUBasedAcceleratorConfiguration::impl_ts_load( sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& xCfg )
{
AcceleratorCache aReadCache = AcceleratorCache();
diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx
index 92320ea82280..f69825f21a68 100644
--- a/framework/source/accelerators/globalacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx
@@ -111,6 +111,25 @@ void GlobalAcceleratorConfiguration::impl_ts_fillCache()
{}
}
+//-----------------------------------------------
+//
+// XComponent.dispose(), #i120029#, to release the cyclic reference
+//
+void SAL_CALL GlobalAcceleratorConfiguration::dispose()
+ throw(css::uno::RuntimeException)
+{
+ try
+ {
+ css::uno::Reference< css::util::XChangesNotifier > xBroadcaster(m_xCfg, css::uno::UNO_QUERY_THROW);
+ if ( xBroadcaster.is() )
+ xBroadcaster->removeChangesListener(static_cast< css::util::XChangesListener* >(this));
+ }
+ catch(const css::uno::RuntimeException&)
+ { throw; }
+ catch(const css::uno::Exception&)
+ {}
+}
+
} // namespace framework
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/accelerators/moduleacceleratorconfiguration.cxx b/framework/source/accelerators/moduleacceleratorconfiguration.cxx
index 09c66b38fb07..382df163b2b5 100644
--- a/framework/source/accelerators/moduleacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/moduleacceleratorconfiguration.cxx
@@ -143,6 +143,25 @@ void ModuleAcceleratorConfiguration::impl_ts_fillCache()
{}
}
+//-----------------------------------------------
+//
+// XComponent.dispose(), #i120029#, to release the cyclic reference
+//
+void SAL_CALL ModuleAcceleratorConfiguration::dispose()
+ throw(css::uno::RuntimeException)
+{
+ try
+ {
+ css::uno::Reference< css::util::XChangesNotifier > xBroadcaster(m_xCfg, css::uno::UNO_QUERY_THROW);
+ if ( xBroadcaster.is() )
+ xBroadcaster->removeChangesListener(static_cast< css::util::XChangesListener* >(this));
+ }
+ catch(const css::uno::RuntimeException&)
+ { throw; }
+ catch(const css::uno::Exception&)
+ {}
+}
+
} // namespace framework
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/inc/accelerators/acceleratorconfiguration.hxx b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
index 2d71deb8d92e..f4e77e5841b9 100644
--- a/framework/source/inc/accelerators/acceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
@@ -290,6 +290,7 @@ class XCUBasedAcceleratorConfiguration : protected ThreadHelpBase
, public ::cppu::OWeakObject
, public css::lang::XTypeProvider
, public css::util::XChangesListener
+ , public css::lang::XComponent
, public css::form::XReset // TODO use XPresetHandler instead if available
, public css::ui::XAcceleratorConfiguration // => css::ui::XUIConfigurationPersistence
// css::ui::XUIConfigurationStorage
@@ -416,6 +417,11 @@ class XCUBasedAcceleratorConfiguration : protected ThreadHelpBase
virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
throw(css::uno::RuntimeException);
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
//______________________________________
// helper for derived classes
diff --git a/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx b/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx
index 1068a4c53987..2d0e33016ebe 100644
--- a/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx
@@ -70,6 +70,9 @@ class GlobalAcceleratorConfiguration : public XCUBasedAcceleratorConfiguration
throw (css::uno::Exception ,
css::uno::RuntimeException);
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+
//______________________________________
// helper
diff --git a/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx b/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx
index bd7838fdc3be..8ff1c9426452 100644
--- a/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx
@@ -81,6 +81,9 @@ class ModuleAcceleratorConfiguration : public XCUBasedAcceleratorConfiguration
throw(css::uno::Exception ,
css::uno::RuntimeException);
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+
//______________________________________
// helper
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index f95021c4e38b..f4d6883cd6f9 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -761,6 +761,9 @@ void SAL_CALL ModuleUIConfigurationManager::dispose() throw (::com::sun::star::u
ResetableGuard aGuard( m_aLock );
Reference< XComponent > xModuleImageManager( m_xModuleImageManager );
m_xModuleImageManager.clear();
+ Reference< XComponent > xCompMAM( m_xModuleAcceleratorManager, UNO_QUERY );
+ if ( xCompMAM.is() )
+ xCompMAM->dispose();
m_xModuleAcceleratorManager.clear();
m_aUIElements[LAYER_USERDEFINED].clear();
m_aUIElements[LAYER_DEFAULT].clear();
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index e90d85990836..60f9f27ff9dd 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -379,6 +379,9 @@ void SAL_CALL MenuBarManager::dispose() throw( RuntimeException )
}
m_xDocImageManager.clear();
m_xModuleImageManager.clear();
+ Reference< XComponent > xCompGAM( m_xGlobalAcceleratorManager, UNO_QUERY );
+ if ( xCompGAM.is() )
+ xCompGAM->dispose();
m_xGlobalAcceleratorManager.clear();
m_xModuleAcceleratorManager.clear();
m_xDocAcceleratorManager.clear();
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index ae5fafbb8b9c..b8ca9bdf206a 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -653,6 +653,9 @@ void SAL_CALL ToolBarManager::dispose() throw( RuntimeException )
m_xFrame.clear();
m_xContext.clear();
+ Reference< XComponent > xCompGAM( m_xGlobalAcceleratorManager, UNO_QUERY );
+ if ( xCompGAM.is() )
+ xCompGAM->dispose();
m_xGlobalAcceleratorManager.clear();
m_xModuleAcceleratorManager.clear();
m_xDocAcceleratorManager.clear();