[Libreoffice-commits] core.git: svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Nov 21 10:25:47 UTC 2018


 svx/source/form/fmexpl.cxx             |    3 ++-
 svx/source/form/navigatortree.cxx      |    4 ++--
 svx/source/form/navigatortreemodel.cxx |    4 ++--
 svx/source/inc/fmexpl.hxx              |    2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 2edc8c53433be4423d7b009c9f60ed732d554816
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Nov 21 10:22:39 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Nov 21 11:25:25 2018 +0100

    tdf#121540 crash deleting a form from form navigator
    
    regression from
        commit eec9f6c8b928de38dd9e683f46bfab00f3243048
        Date:   Mon Jun 4 15:01:43 2018 +0200
        loplugin:useuniqueptr in FmEntryDataList
    
    and rename the method to make the it's operation clearer
    
    Change-Id: Ife366f02c3d8907c397345d825ef7d1721d8930c
    Reviewed-on: https://gerrit.libreoffice.org/63694
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx
index 32f4f8d4d646..76e4b853ef6c 100644
--- a/svx/source/form/fmexpl.cxx
+++ b/svx/source/form/fmexpl.cxx
@@ -132,12 +132,13 @@ FmEntryDataList::~FmEntryDataList()
 }
 
 
-void FmEntryDataList::remove( FmEntryData* pItem )
+void FmEntryDataList::removeNoDelete( FmEntryData* pItem )
 {
     auto it = std::find_if(maEntryDataList.begin(), maEntryDataList.end(),
         [&pItem](const std::unique_ptr<FmEntryData>& rEntryData) { return rEntryData.get() == pItem; });
     if (it != maEntryDataList.end())
     {
+        it->release();
         maEntryDataList.erase( it );
         return;
     }
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index 8e982de47387..c3f0aad652ce 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -1044,9 +1044,9 @@ namespace svxform
 
             // remove from parent
             if (pCurrentParentUserData)
-                pCurrentParentUserData->GetChildList()->remove( pCurrentUserData );
+                pCurrentParentUserData->GetChildList()->removeNoDelete( pCurrentUserData );
             else
-                GetNavModel()->GetRootList()->remove( pCurrentUserData );
+                GetNavModel()->GetRootList()->removeNoDelete( pCurrentUserData );
 
             // remove from container
             sal_Int32 nIndex = getElementPos(xContainer, xCurrentChild);
diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index 62ce8a327dc0..c178c68b6439 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -415,10 +415,10 @@ namespace svxform
 
         // remove from parent
         if (pFolder)
-            pFolder->GetChildList()->remove( pEntry );
+            pFolder->GetChildList()->removeNoDelete( pEntry );
         else
         {
-            GetRootList()->remove( pEntry );
+            GetRootList()->removeNoDelete( pEntry );
 
             // If root has no more form, reset CurForm at shell
             if ( !GetRootList()->size() )
diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx
index 4f26008fa054..6e751c2921f8 100644
--- a/svx/source/inc/fmexpl.hxx
+++ b/svx/source/inc/fmexpl.hxx
@@ -197,7 +197,7 @@ public:
         { return maEntryDataList.at(Index).get(); }
 
     size_t          size() const { return maEntryDataList.size(); }
-    void            remove( FmEntryData* pItem );
+    void            removeNoDelete( FmEntryData* pItem );
     void            insert( std::unique_ptr<FmEntryData> pItem, size_t Index );
     void            clear();
 };


More information about the Libreoffice-commits mailing list