Kaydet (Commit) dd8fa7c2 authored tarafından Caolán McNamara's avatar Caolán McNamara

fix more lifecycle problems

üst ba26ed19
...@@ -684,7 +684,7 @@ XCUBasedAcceleratorConfiguration::XCUBasedAcceleratorConfiguration(const css::un ...@@ -684,7 +684,7 @@ XCUBasedAcceleratorConfiguration::XCUBasedAcceleratorConfiguration(const css::un
, m_pPrimaryWriteCache(0 ) , m_pPrimaryWriteCache(0 )
, m_pSecondaryWriteCache(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 > ( m_xCfg = css::uno::Reference< css::container::XNameAccess > (
::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_ACCELERATORS, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_ACCELERATORS, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ),
css::uno::UNO_QUERY ); css::uno::UNO_QUERY );
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
// own includes // own includes
#include <threadhelp/readguard.hxx> #include <threadhelp/readguard.hxx>
#include <threadhelp/writeguard.hxx> #include <threadhelp/writeguard.hxx>
#include "helper/mischelper.hxx"
#include <acceleratorconst.h> #include <acceleratorconst.h>
#include <services.h> #include <services.h>
...@@ -117,7 +118,8 @@ void GlobalAcceleratorConfiguration::impl_ts_fillCache() ...@@ -117,7 +118,8 @@ void GlobalAcceleratorConfiguration::impl_ts_fillCache()
XCUBasedAcceleratorConfiguration::reload(); XCUBasedAcceleratorConfiguration::reload();
css::uno::Reference< css::util::XChangesNotifier > xBroadcaster(m_xCfg, css::uno::UNO_QUERY_THROW); 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) catch(const css::uno::RuntimeException& exRun)
{ throw exRun; } { throw exRun; }
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
// own includes // own includes
#include <threadhelp/readguard.hxx> #include <threadhelp/readguard.hxx>
#include <threadhelp/writeguard.hxx> #include <threadhelp/writeguard.hxx>
#include "helper/mischelper.hxx"
#include <acceleratorconst.h> #include <acceleratorconst.h>
#include <services.h> #include <services.h>
...@@ -152,7 +153,8 @@ void ModuleAcceleratorConfiguration::impl_ts_fillCache() ...@@ -152,7 +153,8 @@ void ModuleAcceleratorConfiguration::impl_ts_fillCache()
XCUBasedAcceleratorConfiguration::reload(); XCUBasedAcceleratorConfiguration::reload();
css::uno::Reference< css::util::XChangesNotifier > xBroadcaster(m_xCfg, css::uno::UNO_QUERY_THROW); 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) catch(const css::uno::RuntimeException& exRun)
{ throw exRun; } { throw exRun; }
......
...@@ -96,6 +96,9 @@ class GlobalAcceleratorConfiguration : public XCUBasedAcceleratorConfiguration ...@@ -96,6 +96,9 @@ class GlobalAcceleratorConfiguration : public XCUBasedAcceleratorConfiguration
::rtl::OUString m_sLocale; ::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. */ /** read all data into the cache. */
void impl_ts_fillCache(); void impl_ts_fillCache();
......
...@@ -103,6 +103,8 @@ class ModuleAcceleratorConfiguration : public XCUBasedAcceleratorConfiguration ...@@ -103,6 +103,8 @@ class ModuleAcceleratorConfiguration : public XCUBasedAcceleratorConfiguration
// helper // helper
private: 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. */ /** read all data into the cache. */
......
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