[Libreoffice-commits] core.git: svx/source

Stephan Bergmann sbergman at redhat.com
Tue Jan 27 06:03:17 PST 2015


 svx/source/form/fmshimp.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit c072bd1df9bd01b34b99fbff50ee09bd5f5ac6ee
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 27 12:16:59 2015 +0100

    Lock SolarMutex around fmFormShell::DetermineForms calls
    
    At least in JunitTest_forms_unoapi there are calls via URP of
    
     SfxShell::UIFeatureChanged
     FmFormShell::DetermineForms
     FmXFormShell::elementInserted
     cppu::OInterfaceContainerHelper::NotifySingleListener<...>::operator()
     cppu::OInterfaceContainerHelper::forEach<...>
     cppu::OInterfaceContainerHelper::notifyEach<...>
     frm::OInterfaceContainer::implInsert
     frm::OInterfaceContainer::insertByName
     frm::OFormsCollection::insertByName
     ...
    
    where SfxShell::UIFeatureChanged does an svtools::AsynchronLink::Call, and there
    are notorious crashes during JunitTest_forms_unoapi in
    
     vcl::Window::ImplRemoveDel
     Application::RemoveUserEvent
     svtools::AsynchronLink::~AsynchronLink
     SfxShell_Impl::~SfxShell_Impl
     SfxShell::~SfxShell
     FmFomrShell::~FmFormShell
     ...
    
    and the naive hope is that the former's unlocked operations cause some
    corruption that make the latter operate on a dangling AsynchronLink::_nEventId.
    
    (As always, the question is at which level to lock the solar mutex;
    frm::OFormsCollection et al appear to be properly mutex'ed, FmXFormShell appears
    to be virtually un-mutex'ed, except for some smelly m_aInvalidationSafety and
    m_aAsyncSafety, and FmFormShell and SfxShell appear to run under the assumption
    that the solar mutex is always locked.  So stick the guards into FmXFormShell---
    which is the only place calling DetermineForms---under the assumption that that
    is the most likely place needing general mutex clean-up in the future, and thus
    bears the highest chance the potentially becoming redundant guards will be
    noticed again.)
    
    Change-Id: Iad0f4bd9af2bf62330e26ac50edd170f470e79c4

diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 3ba69cc..e76c4f1 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -2548,6 +2548,8 @@ void FmXFormShell::elementInserted(const ContainerEvent& evt) throw(::com::sun::
     Reference< XInterface> xTemp;
     evt.Element >>= xTemp;
     AddElement(xTemp);
+
+    SolarMutexGuard g;
     m_pShell->DetermineForms(true);
 }
 
@@ -2573,6 +2575,8 @@ void FmXFormShell::elementRemoved(const ContainerEvent& evt) throw(::com::sun::s
     Reference< XInterface> xTemp;
     evt.Element >>= xTemp;
     RemoveElement(xTemp);
+
+    SolarMutexGuard g;
     m_pShell->DetermineForms(true);
 }
 
@@ -2598,6 +2602,7 @@ void FmXFormShell::UpdateForms( bool _bInvalidate )
         AddElement( m_xForms );
     }
 
+    SolarMutexGuard g;
     m_pShell->DetermineForms( _bInvalidate );
 }
 


More information about the Libreoffice-commits mailing list