[Libreoffice-commits] .: 3 commits - desktop/scripts desktop/source sfx2/inc sfx2/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri Jun 17 06:12:40 PDT 2011


 desktop/scripts/soffice.sh                          |    2 ++
 desktop/source/deployment/gui/dp_gui_extlistbox.cxx |   12 +++++++++++-
 sfx2/inc/sfx2/app.hxx                               |    1 -
 sfx2/source/appl/app.cxx                            |   19 +++++++------------
 4 files changed, 20 insertions(+), 14 deletions(-)

New commits:
commit 39c86ae49e980ae9b62f511e424b79e1db546d65
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 17 13:38:27 2011 +0100

    Related: rhbz#702833 addEventListener without removeEventListener

diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 8cdf0a6..3d0d426 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -970,18 +970,20 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &
     if ( ! pEntry->m_sTitle.Len() )
         return 0;
 
-    xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
+    bool bNewEntryInserted = false;
 
     ::osl::ClearableMutexGuard guard(m_entriesMutex);
     if ( m_vEntries.empty() )
     {
         m_vEntries.push_back( pEntry );
+        bNewEntryInserted = true;
     }
     else
     {
         if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) )
         {
             m_vEntries.insert( m_vEntries.begin()+nPos, pEntry );
+            bNewEntryInserted = true;
         }
         else if ( !m_bInCheckMode )
         {
@@ -989,6 +991,14 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &
         }
     }
 
+    //Related: rhbz#702833 Only add a Listener if we're adding a new entry, to
+    //keep in sync with removeEventListener logic
+    if (bNewEntryInserted)
+    {
+        pEntry->m_xPackage->addEventListener(uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
+    }
+
+
     pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
     pEntry->m_bUser       = xPackage->getRepositoryName().equals( USER_PACKAGE_MANAGER );
     pEntry->m_bShared     = xPackage->getRepositoryName().equals( SHARED_PACKAGE_MANAGER );
commit f5fe05887c82fee412ce01da218f17b6c6ba8e3a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 17 13:34:08 2011 +0100

    add GLIBCXX_FORCE_NEW for memcheck

diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh
index 41abecd..5dd7882 100755
--- a/desktop/scripts/soffice.sh
+++ b/desktop/scripts/soffice.sh
@@ -78,6 +78,8 @@ if [ "$VALGRIND" != "" ]; then
     if [ "$VALGRIND" = "memcheck" ]; then
         G_SLICE=always-malloc
         export G_SLICE
+        GLIBCXX_FORCE_NEW=1
+        export GLIBCXX_FORCE_NEW
     fi
 fi
 
commit d59761f42a54ff830203ddf7d76b9722a4732bf1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 16 22:08:54 2011 +0100

    remove double mutex

diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx
index e2db8af..625fe0e 100644
--- a/sfx2/inc/sfx2/app.hxx
+++ b/sfx2/inc/sfx2/app.hxx
@@ -138,7 +138,6 @@ class SfxObjectShellLock;
 
 class SFX2_DLLPUBLIC SfxApplication: public SfxShell
 {
-    SAL_DLLPRIVATE static ::osl::Mutex gMutex;
     SAL_DLLPRIVATE static SfxApplication* pApp;
 
     SfxAppData_Impl*            pAppData_Impl;
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index fc6ed19..a362790 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -260,6 +260,9 @@ namespace
 
     class thePropertyHandler
         : public rtl::Static<SfxPropertyHandler, thePropertyHandler> {};
+
+    class theApplicationMutex
+        : public rtl::Static<osl::Mutex, theApplicationMutex> {};
 }
 
 #include <framework/imageproducer.hxx>
@@ -268,23 +271,15 @@ namespace
 #include "sfx2/imagemgr.hxx"
 #include "fwkhelper.hxx"
 
-::osl::Mutex SfxApplication::gMutex;
-
 SfxApplication* SfxApplication::GetOrCreate()
 {
     // SFX on demand
-    ::osl::MutexGuard aGuard(SfxApplication::gMutex);
-    if ( !pApp )
+    ::osl::MutexGuard aGuard(theApplicationMutex::get());
+    if (!pApp)
     {
-        SfxApplication *pNew = new SfxApplication;
-
-        //TODO/CLEANUP
-        // Is the Mutex-Handling OK?
-        static ::osl::Mutex aProtector;
-        ::osl::MutexGuard aGuard2( aProtector );
-
         RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxApplication::SetApp" );
-        pApp = pNew;
+
+        pApp = new SfxApplication;
 
         // at the moment a bug may occur when Initialize_Impl returns FALSE,
         // but this is only temporary because all code that may cause such


More information about the Libreoffice-commits mailing list