[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - chart2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 11 08:04:18 UTC 2018


 chart2/source/controller/main/ChartController_Tools.cxx |   61 ++++++----------
 1 file changed, 23 insertions(+), 38 deletions(-)

New commits:
commit 72a44569af5d69b3093d01e4d16448509a8ad807
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Oct 9 10:26:54 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Oct 11 10:03:56 2018 +0200

    tdf#120387 get lock to use ImpEditView::CutCopy
    
    ImpEditView::CutCopy releases the SolarMutex to handle clipboard
    access. So lock the SolarMutex when accessing this function
    through OutlinerView::Copy().
    
    Now all paths effectively need the SolarMutex, so remove all the
    intermediate locking. I guess the explicit release for the
    xTransferable.is() test isn't needed.
    
    Change-Id: Ib2a69a520bbf0ef7ba4ccb893c6489b292207f2a
    Reviewed-on: https://gerrit.libreoffice.org/61580
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit c11ee0f7b0e4e7bf4d1e2e5bb4309f24b917ce79)
    Reviewed-on: https://gerrit.libreoffice.org/61585
    Tested-by: Xisco Faulí <xiscofauli at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 59444c95d5fb..ffde81935376 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -489,47 +489,32 @@ void ChartController::impl_PasteStringAsTextShape( const OUString& rString, cons
 
 void ChartController::executeDispatch_Copy()
 {
-    if ( m_pDrawViewWrapper )
+    SolarMutexGuard aSolarGuard;
+    if (!m_pDrawViewWrapper)
+        return;
+
+    OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView();
+    if (pOutlinerView)
+        pOutlinerView->Copy();
+    else
     {
-        OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView();
-        if ( pOutlinerView )
-        {
-            pOutlinerView->Copy();
-        }
-        else
+        SdrObject* pSelectedObj = nullptr;
+        ObjectIdentifier aSelOID(m_aSelection.getSelectedOID());
+
+        if (aSelOID.isAutoGeneratedObject())
+            pSelectedObj = m_pDrawModelWrapper->getNamedSdrObject( aSelOID.getObjectCID() );
+        else if (aSelOID.isAdditionalShape())
+            pSelectedObj = DrawViewWrapper::getSdrObject( aSelOID.getAdditionalShape() );
+
+        if (pSelectedObj)
         {
-            Reference< datatransfer::XTransferable > xTransferable;
+            Reference<datatransfer::clipboard::XClipboard> xClipboard(GetChartWindow()->GetClipboard());
+            if (xClipboard.is())
             {
-                SolarMutexGuard aSolarGuard;
-                if ( m_pDrawModelWrapper )
-                {
-                    SdrObject* pSelectedObj = nullptr;
-                    ObjectIdentifier aSelOID( m_aSelection.getSelectedOID() );
-                    if ( aSelOID.isAutoGeneratedObject() )
-                    {
-                        pSelectedObj = m_pDrawModelWrapper->getNamedSdrObject( aSelOID.getObjectCID() );
-                    }
-                    else if ( aSelOID.isAdditionalShape() )
-                    {
-                        pSelectedObj = DrawViewWrapper::getSdrObject( aSelOID.getAdditionalShape() );
-                    }
-                    if ( pSelectedObj )
-                    {
-                        xTransferable.set( new ChartTransferable(
-                                m_pDrawModelWrapper->getSdrModel(),
-                                pSelectedObj,
-                                aSelOID.isAdditionalShape() ) );
-                    }
-                }
-            }
-            if ( xTransferable.is() )
-            {
-                SolarMutexGuard aSolarGuard;
-                Reference<datatransfer::clipboard::XClipboard> xClipboard(GetChartWindow()->GetClipboard());
-                if ( xClipboard.is() )
-                {
-                    xClipboard->setContents( xTransferable, Reference< datatransfer::clipboard::XClipboardOwner >() );
-                }
+                Reference< datatransfer::XTransferable > xTransferable(
+                    new ChartTransferable(m_pDrawModelWrapper->getSdrModel(),
+                                          pSelectedObj, aSelOID.isAdditionalShape()));
+                xClipboard->setContents(xTransferable, Reference< datatransfer::clipboard::XClipboardOwner >());
             }
         }
     }


More information about the Libreoffice-commits mailing list