summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-03-23 16:10:20 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-03-23 17:07:25 +0000
commitdd8fa7c25af9614dbee5a7795b95d8583093f65b (patch)
tree633e4ab5aab3eef11b5752890d018b47009ad185
parentba26ed19d82638f3bda7039edaa37addf274e95f (diff)
fix more lifecycle problems
-rwxr-xr-xframework/source/accelerators/acceleratorconfiguration.cxx2
-rwxr-xr-xframework/source/accelerators/globalacceleratorconfiguration.cxx4
-rwxr-xr-xframework/source/accelerators/moduleacceleratorconfiguration.cxx4
-rwxr-xr-xframework/source/inc/accelerators/globalacceleratorconfiguration.hxx3
-rwxr-xr-xframework/source/inc/accelerators/moduleacceleratorconfiguration.hxx2
5 files changed, 12 insertions, 3 deletions
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index 19f1e99188b0..d2f958be8838 100755
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -684,7 +684,7 @@ XCUBasedAcceleratorConfiguration::XCUBasedAcceleratorConfiguration(const css::un
, m_pPrimaryWriteCache(0 )
, m_pSecondaryWriteCache(0 )
{
- static const ::rtl::OUString CFG_ENTRY_ACCELERATORS(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Accelerators"));
+ const ::rtl::OUString CFG_ENTRY_ACCELERATORS(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Accelerators"));
m_xCfg = css::uno::Reference< css::container::XNameAccess > (
::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_ACCELERATORS, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ),
css::uno::UNO_QUERY );
diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx
index 25be0bb8ad87..173d19cd7d7e 100755
--- a/framework/source/accelerators/globalacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx
@@ -34,6 +34,7 @@
// own includes
#include <threadhelp/readguard.hxx>
#include <threadhelp/writeguard.hxx>
+#include "helper/mischelper.hxx"
#include <acceleratorconst.h>
#include <services.h>
@@ -117,7 +118,8 @@ void GlobalAcceleratorConfiguration::impl_ts_fillCache()
XCUBasedAcceleratorConfiguration::reload();
css::uno::Reference< css::util::XChangesNotifier > xBroadcaster(m_xCfg, css::uno::UNO_QUERY_THROW);
- xBroadcaster->addChangesListener(static_cast< css::util::XChangesListener* >(this));
+ m_xCfgListener = new WeakChangesListener(this);
+ xBroadcaster->addChangesListener(m_xCfgListener);
}
catch(const css::uno::RuntimeException& exRun)
{ throw exRun; }
diff --git a/framework/source/accelerators/moduleacceleratorconfiguration.cxx b/framework/source/accelerators/moduleacceleratorconfiguration.cxx
index 42f2bba1d283..5f1f3b7e0d94 100755
--- a/framework/source/accelerators/moduleacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/moduleacceleratorconfiguration.cxx
@@ -34,6 +34,7 @@
// own includes
#include <threadhelp/readguard.hxx>
#include <threadhelp/writeguard.hxx>
+#include "helper/mischelper.hxx"
#include <acceleratorconst.h>
#include <services.h>
@@ -152,7 +153,8 @@ void ModuleAcceleratorConfiguration::impl_ts_fillCache()
XCUBasedAcceleratorConfiguration::reload();
css::uno::Reference< css::util::XChangesNotifier > xBroadcaster(m_xCfg, css::uno::UNO_QUERY_THROW);
- xBroadcaster->addChangesListener(static_cast< css::util::XChangesListener* >(this));
+ m_xCfgListener = new WeakChangesListener(this);
+ xBroadcaster->addChangesListener(m_xCfgListener);
}
catch(const css::uno::RuntimeException& exRun)
{ throw exRun; }
diff --git a/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx b/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx
index 5cb106aab66c..28c7ba4eb12b 100755
--- a/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx
@@ -96,6 +96,9 @@ class GlobalAcceleratorConfiguration : public XCUBasedAcceleratorConfiguration
::rtl::OUString m_sLocale;
+ /** helper to listen for configuration changes without ownership cycle problems */
+ css::uno::Reference< css::util::XChangesListener > m_xCfgListener;
+
//----------------------------------
/** read all data into the cache. */
void impl_ts_fillCache();
diff --git a/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx b/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx
index 7feeea3b10b9..05588598ebf8 100755
--- a/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx
@@ -103,6 +103,8 @@ class ModuleAcceleratorConfiguration : public XCUBasedAcceleratorConfiguration
// helper
private:
+ /** helper to listen for configuration changes without ownership cycle problems */
+ css::uno::Reference< css::util::XChangesListener > m_xCfgListener;
//----------------------------------
/** read all data into the cache. */