[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - editeng/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Sun Jun 4 12:19:51 UTC 2017


 editeng/source/editeng/editobj.cxx |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit a5f911f04f986d424df5393fb9a2744fdf770f21
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sun Jun 4 11:33:31 2017 +0200

    tdf#108324 fix crash: paste from textframe
    
    rAttr references *pC->maCharAttribs[nAttr].get() and assignment of
    a unique_ptr is essentially a reset, invalidating the reference.
    
    regression of commit    dd891ec422fb35eada219ca7adddbd60d69f1fb7
            cppcheck: memleak (false positive)
            but manage ownership from start
    
    Change-Id: Ica81f0af18e11b32d2f97045961630858c78e9af
    Reviewed-on: https://gerrit.libreoffice.org/38382
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>
    (cherry picked from commit 453ce05c3951b6459a6450e6ac09377f70ecbc16)
    Reviewed-on: https://gerrit.libreoffice.org/38383

diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index b215865d0ee3..ed1fdb06136e 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -1429,9 +1429,8 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream )
                     aNewFontItem.SetFamilyName( GetFontToSubsFontName( hConv ) );
 
                     // Replace the existing attribute with a new one.
-                    pC->maCharAttribs[nAttr] =
-                            std::unique_ptr<XEditAttribute>(CreateAttrib(aNewFontItem, rAttr.GetStart(), rAttr.GetEnd()));
                     pPool->Remove(*rAttr.GetItem());
+                    pC->maCharAttribs[nAttr].reset(CreateAttrib(aNewFontItem, rAttr.GetStart(), rAttr.GetEnd()));
 
                     XEditAttribute* pNewAttr = pC->maCharAttribs[nAttr].get();
                     for ( sal_Int32 nChar = pNewAttr->GetStart(); nChar < pNewAttr->GetEnd(); nChar++ )


More information about the Libreoffice-commits mailing list