[Libreoffice-commits] core.git: framework/inc framework/source vcl/source

Stephan Bergmann sbergman at redhat.com
Tue May 6 07:37:06 PDT 2014


 framework/inc/dispatch/closedispatcher.hxx    |    3 ++-
 framework/source/dispatch/closedispatcher.cxx |   10 ++++++++--
 vcl/source/helper/evntpost.cxx                |    6 ++++++
 3 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit db06595d13ab00c1c7584456b4bcd85797eadaa9
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue May 6 16:33:55 2014 +0200

    vcl::EventPoster shall probably be covered by SolarMutex
    
    ...as most parts of VCL.  Ran across at least one case where a remote call to
    framework::CloseDispatcher::release -> ~CloseDispatcher -> ~EventPoster ->
    Application::RemoveUserEvent caused a crash.  As always with SolarMutex, keep
    fingers crossed that this is about the right level to acquire it.
    
    Change-Id: I8f4be7329adbf72355774fa5d3c472270da3ddd2

diff --git a/framework/inc/dispatch/closedispatcher.hxx b/framework/inc/dispatch/closedispatcher.hxx
index 3c01754..db5f7c3 100644
--- a/framework/inc/dispatch/closedispatcher.hxx
+++ b/framework/inc/dispatch/closedispatcher.hxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/frame/DispatchResultState.hpp>
 
+#include <boost/scoped_ptr.hpp>
 #include <cppuhelper/implbase2.hxx>
 #include <vcl/evntpost.hxx>
 
@@ -88,7 +89,7 @@ class CloseDispatcher : public  ::cppu::WeakImplHelper2<
         /** @short  used for asynchronous callbacks within the main thread.
             @descr  Internally we work asynchronous. Because our callis
                     are not aware, that her request can kill its own environment ... */
-        ::vcl::EventPoster m_aAsyncCallback;
+        boost::scoped_ptr<vcl::EventPoster> m_aAsyncCallback;
 
         /** @short  used inside asyncronous callback to decide,
                     which operation must be executed. */
diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx
index afef22b..f511d00 100644
--- a/framework/source/dispatch/closedispatcher.cxx
+++ b/framework/source/dispatch/closedispatcher.cxx
@@ -57,7 +57,8 @@ CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::uno::XComponent
                                  const css::uno::Reference< css::frame::XFrame >&          xFrame ,
                                  const OUString&                                           sTarget)
     : m_xContext         (rxContext                                       )
-    , m_aAsyncCallback   (LINK( this, CloseDispatcher, impl_asyncCallback))
+    , m_aAsyncCallback(
+        new vcl::EventPoster(LINK(this, CloseDispatcher, impl_asyncCallback)))
     , m_eOperation(E_CLOSE_DOC)
     , m_lStatusListener(m_mutex)
     , m_pSysWindow(NULL)
@@ -77,6 +78,8 @@ CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::uno::XComponent
 
 CloseDispatcher::~CloseDispatcher()
 {
+    SolarMutexGuard g;
+    m_aAsyncCallback.reset();
 }
 
 void SAL_CALL CloseDispatcher::dispatch(const css::util::URL&                                  aURL      ,
@@ -215,7 +218,10 @@ void SAL_CALL CloseDispatcher::dispatchWithNotification(const css::util::URL&
     if ( bIsSynchron )
         impl_asyncCallback(0);
     else
-        m_aAsyncCallback.Post(0);
+    {
+        SolarMutexGuard g;
+        m_aAsyncCallback->Post(0);
+    }
 }
 
 /**
diff --git a/vcl/source/helper/evntpost.cxx b/vcl/source/helper/evntpost.cxx
index 6c551e1..28ede4a 100644
--- a/vcl/source/helper/evntpost.cxx
+++ b/vcl/source/helper/evntpost.cxx
@@ -17,6 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <tools/debug.hxx>
 #include <vcl/evntpost.hxx>
 #include <vcl/svapp.hxx>
 
@@ -31,6 +34,7 @@ EventPoster::EventPoster( const Link& rLink )
 
 EventPoster::~EventPoster()
 {
+    DBG_TESTSOLARMUTEX();
     if ( m_nId )
         GetpApp()->RemoveUserEvent( m_nId );
 }
@@ -38,11 +42,13 @@ EventPoster::~EventPoster()
 void EventPoster::Post( UserEvent* pEvent )
 
 {
+    DBG_TESTSOLARMUTEX();
     m_nId = GetpApp()->PostUserEvent( ( LINK( this, EventPoster, DoEvent_Impl ) ), pEvent );
 }
 
 IMPL_LINK( EventPoster, DoEvent_Impl, UserEvent*, pEvent )
 {
+    DBG_TESTSOLARMUTEX();
     m_nId = 0;
     m_aLink.Call( pEvent );
     return 0;


More information about the Libreoffice-commits mailing list