[Libreoffice-commits] core.git: 3 commits - basic/source sw/source

Michael Stahl mstahl at redhat.com
Wed Oct 8 06:51:14 PDT 2014


 basic/source/basmgr/basicmanagerrepository.cxx |   18 ++++++++++--------
 basic/source/uno/namecont.cxx                  |    4 ++--
 sw/source/uibase/docvw/PostItMgr.cxx           |    2 +-
 3 files changed, 13 insertions(+), 11 deletions(-)

New commits:
commit 6edebc078c527112e15c75f2666653e5f53dc171
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 8 15:30:54 2014 +0200

    SwPostItMgr::RemoveItem(): AddressSanitizer: heap-use-after-free
    
    Calling std::list::remove() iterates over all elements...
    
    Change-Id: I46d00217911c1863f70d3ba72dc7099411714471

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 6b1d5c9..5daecba 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -243,7 +243,7 @@ void SwPostItMgr::RemoveItem( SfxBroadcaster* pBroadcast )
             SwSidebarItem* p = (*i);
             if (GetActiveSidebarWin() == p->pPostIt)
                 SetActiveSidebarWin(0);
-            mvPostItFlds.remove(*i);
+            mvPostItFlds.erase(i);
             delete p->pPostIt;
             delete p;
             break;
commit fca62934f492125ea6728fd6d09f0c66c9e4fa69
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 8 15:21:07 2014 +0200

    basic: use SolarMutex to lock SfxLibraryContainer
    
    Originally this used both SolarMutex and an own mutex, then a deadlock
    was resolved in 2fe6a4a34b38c05e252c71f4d2f18e4a90e61b29 by not locking
    SolarMutex.
    
    Since the class will call event listeners without dropping the mutex
    e.g. in insertNoCheck(), using the SolarMutex appears better anyway.
    
    With this, installing a BASIC extension no longer triggers SolarMutex
    asserts in SfxBroadcaster.
    
    Change-Id: Ib9a2ee491ef53b1a53855af0fc22e863c5e7cb91

diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 55d7327..db22aef 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -417,13 +417,13 @@ void SfxLibraryContainer::checkDisposed() const
 
 void SfxLibraryContainer::enterMethod()
 {
-    maMutex.acquire();
+    Application::GetSolarMutex().acquire();
     checkDisposed();
 }
 
 void SfxLibraryContainer::leaveMethod()
 {
-    maMutex.release();
+    Application::GetSolarMutex().release();
 }
 
 BasicManager* SfxLibraryContainer::getBasicManager()
commit 26b79470cabb191c3291789f99d8737da1a4fbab
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 8 15:11:34 2014 +0200

    basic::ImplRepository: use SolarMutex instead of own mutex
    
    The locking strategy in the basic module is totally unclear to me, there
    does not appear to be a dedicated mutex for the core stuff callable via
    StarBASIC, just a bunch of SolarMutexGuards at random locations;
    let's try to use SolarMutex at the UNO entry points...
    
    Change-Id: Ia9c45fdcfb5ffd0a4acc77ef5d2fabfb8743ad38

diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index bcf0855..d7928d8 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -81,7 +81,6 @@ namespace basic
         ImplRepository();
 
     private:
-        ::osl::Mutex        m_aMutex;
         BasicManagerStore   m_aStore;
         CreationListeners   m_aCreationListeners;
 
@@ -222,7 +221,7 @@ namespace basic
 
     BasicManager* ImplRepository::getDocumentBasicManager( const Reference< XModel >& _rxDocumentModel )
     {
-        ::osl::MutexGuard aGuard( m_aMutex );
+        SolarMutexGuard g;
 
         /*  #163556# (DR) - This function may be called recursively while
             constructing the Basic manager and loading the Basic storage. By
@@ -242,7 +241,7 @@ namespace basic
 
     BasicManager* ImplRepository::getApplicationBasicManager( bool _bCreate )
     {
-        ::osl::MutexGuard aGuard( m_aMutex );
+        SolarMutexGuard g;
 
         BasicManager* pAppManager = GetSbData()->pAppBasMgr;
         if ( ( pAppManager == NULL ) && _bCreate )
@@ -254,7 +253,7 @@ namespace basic
 
     void ImplRepository::setApplicationBasicManager( BasicManager* _pBasicManager )
     {
-        ::osl::MutexGuard aGuard( m_aMutex );
+        SolarMutexGuard g;
 
         BasicManager* pPreviousManager = getApplicationBasicManager( false );
         delete pPreviousManager;
@@ -265,7 +264,8 @@ namespace basic
 
     BasicManager* ImplRepository::impl_createApplicationBasicManager()
     {
-        ::osl::MutexGuard aGuard( m_aMutex );
+        SolarMutexGuard g;
+
         OSL_PRECOND( getApplicationBasicManager( false ) == NULL, "ImplRepository::impl_createApplicationBasicManager: there already is one!" );
 
         // Determine Directory
@@ -324,14 +324,16 @@ namespace basic
 
     void ImplRepository::registerCreationListener( BasicManagerCreationListener& _rListener )
     {
-        ::osl::MutexGuard aGuard( m_aMutex );
+        SolarMutexGuard g;
+
         m_aCreationListeners.push_back( &_rListener );
     }
 
 
     void ImplRepository::revokeCreationListener( BasicManagerCreationListener& _rListener )
     {
-        ::osl::MutexGuard aGuard( m_aMutex );
+        SolarMutexGuard g;
+
         CreationListeners::iterator pos = ::std::find( m_aCreationListeners.begin(), m_aCreationListeners.end(), &_rListener );
         if ( pos != m_aCreationListeners.end() )
             m_aCreationListeners.erase( pos );
@@ -542,7 +544,7 @@ namespace basic
 
     void ImplRepository::_disposing( const ::com::sun::star::lang::EventObject& _rSource )
     {
-        ::osl::MutexGuard aGuard( m_aMutex );
+        SolarMutexGuard g;
 
         Reference< XInterface > xNormalizedSource( _rSource.Source, UNO_QUERY );
     #if OSL_DEBUG_LEVEL > 0


More information about the Libreoffice-commits mailing list