[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 5 commits - officecfg/registry sw/source

Caolán McNamara caolanm at redhat.com
Tue Jun 6 12:06:59 UTC 2017


 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |    2 -
 sw/source/core/edit/edfcol.cxx                                      |   11 ++++++++--
 sw/source/uibase/app/docst.cxx                                      |    4 +--
 sw/source/uibase/dialog/watermarkdialog.cxx                         |    8 +++++--
 4 files changed, 18 insertions(+), 7 deletions(-)

New commits:
commit 43793cdce361004b11d2acde4470350afb9d26f7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 26 10:27:48 2017 +0100

    coverity#1409895 Resource leak
    
    Change-Id: I1430ac41bf11bf3ae5c4cba3406a24148acd728e
    (cherry picked from commit e805881d74392969746d34756b035850c67883e6)

diff --git a/sw/source/uibase/dialog/watermarkdialog.cxx b/sw/source/uibase/dialog/watermarkdialog.cxx
index 6b993d22caf1..29131215a72b 100644
--- a/sw/source/uibase/dialog/watermarkdialog.cxx
+++ b/sw/source/uibase/dialog/watermarkdialog.cxx
@@ -57,12 +57,16 @@ void SwWatermarkDialog::InitFields()
     SfxObjectShell* pDocSh = SfxObjectShell::Current();
     const SfxPoolItem* pFontItem;
     const FontList* pFontList = nullptr;
+    std::unique_ptr<FontList> xFontList;
 
     if ( pDocSh && ( ( pFontItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ) ) != nullptr ) )
         pFontList = static_cast<const SvxFontListItem*>( pFontItem )->GetFontList();
 
-    if(!pFontList)
-        pFontList = new FontList(Application::GetDefaultDevice(), nullptr);
+    if (!pFontList)
+    {
+        xFontList.reset(new FontList(Application::GetDefaultDevice(), nullptr));
+        pFontList = xFontList.get();
+    }
 
     m_pFont->Fill( pFontList );
 
commit 48c9369f68560dd8865da40ecd9227dc2240e28d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 26 10:35:57 2017 +0100

    coverity#1409896 Dereference before null check
    
    should this be pShell instead of pSh ?
    
    Change-Id: Ie653dbbdee8cebc402c9ee9e78630353ba977921
    (cherry picked from commit 6ee4b68ce5bd52b31713fc5213594e54b2412737)

diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 6eff974face6..faa2ac13d814 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -275,10 +275,10 @@ void  SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
                 rSet.InvalidateItem(nWhich);
                 break;
             case SID_WATERMARK:
+                if (pSh)
                 {
                     SfxWatermarkItem aItem = pSh->GetWatermark();
-                    if( pSh )
-                        rSet.Put(aItem);
+                    rSet.Put(aItem);
                 }
                 break;
             default:
commit c325057e7ad89e3286bc54b04fb4221be868a69f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun May 28 17:15:08 2017 +0200

    Related: tdf#106950 sw: fix crash on opening this file
    
    Not every paragraph supports the container::XEnumerationAccess
    interface.
    
    Change-Id: I0690f2e631f733b8f478a7df30d2918400eccf2f
    Reviewed-on: https://gerrit.libreoffice.org/38111
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>
    (cherry picked from commit e01c6a3ba7c0e6a089769187ee1ad241aa862280)

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 1627ce0bd8d9..82256317bb20 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -124,6 +124,9 @@ uno::Reference<drawing::XShape> lcl_getWatermark(const uno::Reference<text::XTex
     while (xParagraphs->hasMoreElements())
     {
         uno::Reference<container::XEnumerationAccess> xTextPortionEnumerationAccess(xParagraphs->nextElement(), uno::UNO_QUERY);
+        if (!xTextPortionEnumerationAccess.is())
+            continue;
+
         uno::Reference<container::XEnumeration> xTextPortions = xTextPortionEnumerationAccess->createEnumeration();
         while (xTextPortions->hasMoreElements())
         {
commit 2a04bf86d9e8f5e04115780d2cae6322b52ef522
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 26 10:39:47 2017 +0100

    coverity#1409893 Division or modulo by float zero
    
    Change-Id: I697e9c7772792b02257ed1f40666dd70bb70300c
    (cherry picked from commit bc28dde1891fd6e3b7ded3f2603aaf63a9111106)

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index bd139d75799c..1627ce0bd8d9 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -404,8 +404,12 @@ void SwEditShell::SetWatermark(const SfxWatermarkItem& rWatermark)
             OutputDevice* pOut = Application::GetDefaultDevice();
             vcl::Font aFont(pOut->GetFont());
             aFont.SetFamilyName(sFont);
-            fRatio = aFont.GetFontSize().Height();
-            fRatio /= pOut->GetTextWidth(rWatermark.GetText());
+            auto nTextWidth = pOut->GetTextWidth(rWatermark.GetText());
+            if (nTextWidth)
+            {
+                fRatio = aFont.GetFontSize().Height();
+                fRatio /= nTextWidth;
+            }
 
             // Calc the size.
             sal_Int32 nWidth = 0;
commit 781c8986f2efa35229ab662edef5ebe06c3ca4f3
Author: Andras Timar <andras.timar at collabora.com>
Date:   Wed May 24 11:02:14 2017 +0200

    Watermark command opens a dialog, add ... to the label
    
    Change-Id: I274661b1ec892425d84cd72194c376e498bf70ed
    (cherry picked from commit 439cdc8530fef0d7e1a62a66c094a27af2181309)

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 327a7dcd2ad8..a93ed1e2318a 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -2885,7 +2885,7 @@
       </node>
       <node oor:name=".uno:Watermark" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
-          <value xml:lang="en-US">Watermark</value>
+          <value xml:lang="en-US">Watermark...</value>
         </prop>
         <prop oor:name="Properties" oor:type="xs:int">
           <value>1</value>


More information about the Libreoffice-commits mailing list