diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-21 10:22:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-21 13:56:22 +0100 |
commit | c4b76e9cb2cddfcc758a6459255bf3c1704ad990 (patch) | |
tree | 915657e334945bacfdf1973c02db420eb1347aa9 /svx | |
parent | 832c9836e4fb649cf6860aadced35ae6def0adf5 (diff) |
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
Reviewed-on: https://gerrit.libreoffice.org/63694
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 2edc8c53433be4423d7b009c9f60ed732d554816)
Change-Id: Ife366f02c3d8907c397345d825ef7d1721d8930c
Reviewed-on: https://gerrit.libreoffice.org/63704
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/form/fmexpl.cxx | 3 | ||||
-rw-r--r-- | svx/source/form/navigatortree.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/navigatortreemodel.cxx | 4 | ||||
-rw-r--r-- | svx/source/inc/fmexpl.hxx | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx index 8fec9e0f5798..8f636b92d962 100644 --- a/svx/source/form/fmexpl.cxx +++ b/svx/source/form/fmexpl.cxx @@ -132,13 +132,14 @@ FmEntryDataList::~FmEntryDataList() } -void FmEntryDataList::remove( FmEntryData* pItem ) +void FmEntryDataList::removeNoDelete( FmEntryData* pItem ) { auto aEnd = maEntryDataList.end(); for ( auto it = maEntryDataList.begin(); it != aEnd; ++it ) { if ( it->get() == pItem ) { + it->release(); maEntryDataList.erase( it ); return; } diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 29392f811489..2a44e7d9953a 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1053,9 +1053,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(); }; |