[Libreoffice-commits] .: 2 commits - framework/source

Caolán McNamara caolan at kemper.freedesktop.org
Wed Mar 23 10:08:59 PDT 2011


 framework/source/accelerators/acceleratorconfiguration.cxx           |    2 +-
 framework/source/accelerators/globalacceleratorconfiguration.cxx     |    4 +++-
 framework/source/accelerators/moduleacceleratorconfiguration.cxx     |    4 +++-
 framework/source/inc/accelerators/globalacceleratorconfiguration.hxx |    3 +++
 framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx |    2 ++
 framework/source/layoutmanager/toolbarlayoutmanager.cxx              |    2 ++
 6 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 776993f1255e738f34ba5c9c154bffa64ae564e8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 23 16:10:49 2011 +0000

    fix leak

diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 20e8817..61e787e 100755
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -96,6 +96,8 @@ ToolbarLayoutManager::ToolbarLayoutManager(
 
 ToolbarLayoutManager::~ToolbarLayoutManager()
 {
+    delete m_pGlobalSettings;
+    delete m_pAddonOptions;
 }
 
 //---------------------------------------------------------------------------------------------------------
commit 796262462d58a3a0ece4411cd314ece2d6cf3290
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 23 16:10:20 2011 +0000

    fix more lifecycle problems

diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index ef23cab..c406e71 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 3d2c8d9..c60b7a8 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 e0ee119..da14ccd 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 e83eaee..fad58fc 100755
--- a/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx
@@ -95,6 +95,9 @@ class GlobalAcceleratorConfiguration : public XCUBasedAcceleratorConfiguration
     private:
 
         ::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. */
diff --git a/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx b/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx
index 5f073f8..fc4d53b 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. */


More information about the Libreoffice-commits mailing list