embeddedobj/source/commonembedding/miscobj.cxx |   22 ++++++++++++----------
 svtools/source/misc/transfer.cxx               |    4 ----
 2 files changed, 12 insertions(+), 14 deletions(-)

New commits:
commit e233fe86fba26a9db260164e44d387de0d22ac8d
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Thu Jul 14 21:59:30 2016 +0200

    try to avoid the deadlock around the clipboard, tdf#56818
    
    This deadlocks in the case that we have an external process
    communicating with LibreOffice as the SolarMutexReleaser allows a
    connection to be processed while the normal code has just released the
    SolarMutex. If the external call code now goes down the same code path
    we deadlock on the SolarMutex together with other mutexes in the
    clipboard code.
    
    Change-Id: I18fd6953c9566452a31b1a4c32c68494ec7a52ac
    Reviewed-on: https://gerrit.libreoffice.org/27251
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index f21d861..fbfb9d2 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -922,8 +922,6 @@ void TransferableHelper::CopyToClipboard( vcl::Window 
*pWindow ) const
 
     if( mxClipboard.is() && !mxTerminateListener.is() )
     {
-        SolarMutexReleaser aReleaser;
-
         try
         {
             TransferableHelper*                 pThis = const_cast< 
TransferableHelper* >( this );
@@ -949,8 +947,6 @@ void TransferableHelper::CopyToSelection( vcl::Window 
*pWindow ) const
 
     if( xSelection.is() && !mxTerminateListener.is() )
     {
-        SolarMutexReleaser aReleaser;
-
         try
         {
             TransferableHelper*                 pThis = const_cast< 
TransferableHelper* >( this );
commit f5dc9bf0a896da8602661978cfa7b2970244ea7d
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Fri Jul 8 09:07:44 2016 +0200

    tdf#56818, use SolarMutex instead of own Mutex
    
    There is a SolarMutexReleaser in the call chain so that using an own
    mutex can deadlock.
    
    Change-Id: I1dd0b0c78ce6cf436a470319e616099cb947b6e0
    Reviewed-on: https://gerrit.libreoffice.org/27085
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index bba9f26..00464a7 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -32,6 +32,8 @@
 #include <comphelper/mimeconfighelper.hxx>
 #include <comphelper/processfactory.hxx>
 
+#include <vcl/svapp.hxx>
+
 #include "closepreventer.hxx"
 #include "intercept.hxx"
 #include "persistence.hxx"
@@ -435,7 +437,7 @@ void SAL_CALL OCommonEmbeddedObject::setClassInfo(
 uno::Reference< util::XCloseable > SAL_CALL 
OCommonEmbeddedObject::getComponent()
         throw ( uno::RuntimeException, std::exception )
 {
-    ::osl::MutexGuard aGuard( m_aMutex );
+    SolarMutexGuard aGuard;
     if ( m_bDisposed )
         throw lang::DisposedException(); // TODO
 
@@ -454,7 +456,7 @@ uno::Reference< util::XCloseable > SAL_CALL 
OCommonEmbeddedObject::getComponent(
 void SAL_CALL OCommonEmbeddedObject::addStateChangeListener( const 
uno::Reference< embed::XStateChangeListener >& xListener )
     throw ( uno::RuntimeException, std::exception )
 {
-    ::osl::MutexGuard aGuard( m_aMutex );
+    SolarMutexGuard aGuard;
     if ( m_bDisposed )
         throw lang::DisposedException(); // TODO
 
@@ -470,7 +472,7 @@ void SAL_CALL 
OCommonEmbeddedObject::removeStateChangeListener(
                     const uno::Reference< embed::XStateChangeListener >& 
xListener )
     throw (uno::RuntimeException, std::exception)
 {
-    ::osl::MutexGuard aGuard( m_aMutex );
+    SolarMutexGuard aGuard;
     if ( m_pInterfaceContainer )
         m_pInterfaceContainer->removeInterface( 
cppu::UnoType<embed::XStateChangeListener>::get(),
                                                 xListener );
@@ -481,7 +483,7 @@ void SAL_CALL OCommonEmbeddedObject::close( sal_Bool 
bDeliverOwnership )
     throw ( util::CloseVetoException,
             uno::RuntimeException, std::exception )
 {
-    ::osl::MutexGuard aGuard( m_aMutex );
+    SolarMutexGuard aGuard;
     if ( m_bClosed )
         throw lang::DisposedException(); // TODO
 
@@ -585,12 +587,12 @@ void SAL_CALL OCommonEmbeddedObject::close( sal_Bool 
bDeliverOwnership )
 void SAL_CALL OCommonEmbeddedObject::addCloseListener( const uno::Reference< 
util::XCloseListener >& xListener )
     throw ( uno::RuntimeException, std::exception )
 {
-    ::osl::MutexGuard aGuard( m_aMutex );
+    SolarMutexGuard aGuard;
     if ( m_bDisposed )
         throw lang::DisposedException(); // TODO
 
     if ( !m_pInterfaceContainer )
-        m_pInterfaceContainer = new 
::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
+        m_pInterfaceContainer = new 
::cppu::OMultiTypeInterfaceContainerHelper(m_aMutex);
 
     m_pInterfaceContainer->addInterface( 
cppu::UnoType<util::XCloseListener>::get(), xListener );
 }
@@ -599,7 +601,7 @@ void SAL_CALL OCommonEmbeddedObject::addCloseListener( 
const uno::Reference< uti
 void SAL_CALL OCommonEmbeddedObject::removeCloseListener( const 
uno::Reference< util::XCloseListener >& xListener )
     throw (uno::RuntimeException, std::exception)
 {
-    ::osl::MutexGuard aGuard( m_aMutex );
+    SolarMutexGuard aGuard;
     if ( m_pInterfaceContainer )
         m_pInterfaceContainer->removeInterface( 
cppu::UnoType<util::XCloseListener>::get(),
                                                 xListener );
@@ -609,12 +611,12 @@ void SAL_CALL OCommonEmbeddedObject::removeCloseListener( 
const uno::Reference<
 void SAL_CALL OCommonEmbeddedObject::addEventListener( const uno::Reference< 
document::XEventListener >& xListener )
         throw ( uno::RuntimeException, std::exception )
 {
-    ::osl::MutexGuard aGuard( m_aMutex );
+    SolarMutexGuard aGuard;
     if ( m_bDisposed )
         throw lang::DisposedException(); // TODO
 
     if ( !m_pInterfaceContainer )
-        m_pInterfaceContainer = new 
::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
+        m_pInterfaceContainer = new 
::cppu::OMultiTypeInterfaceContainerHelper(m_aMutex);
 
     m_pInterfaceContainer->addInterface( 
cppu::UnoType<document::XEventListener>::get(), xListener );
 }
@@ -623,7 +625,7 @@ void SAL_CALL OCommonEmbeddedObject::addEventListener( 
const uno::Reference< doc
 void SAL_CALL OCommonEmbeddedObject::removeEventListener( const 
uno::Reference< document::XEventListener >& xListener )
         throw ( uno::RuntimeException, std::exception )
 {
-    ::osl::MutexGuard aGuard( m_aMutex );
+    SolarMutexGuard aGuard;
     if ( m_pInterfaceContainer )
         m_pInterfaceContainer->removeInterface( 
cppu::UnoType<document::XEventListener>::get(),
                                                 xListener );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to