summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-02-07 09:10:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-02-07 12:36:45 +0100
commitdd9434929e507e5989bed94bbafe4fe891bf6c22 (patch)
tree90b7b108f6a07f567d9483037da59d424b8f2d9a /svx
parent0cbc61e2ae76ffefd579979fbc164747898d8126 (diff)
use swap instead of copy and clear
Change-Id: I51aa680e66aa0a5186edadf9d5a2d57798be4103 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88165 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdobj.cxx13
1 files changed, 6 insertions, 7 deletions
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index d1d898379fdf..ded90158472b 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -394,18 +394,17 @@ SdrObject::SdrObject(SdrModel& rSdrModel)
SdrObject::~SdrObject()
{
- // tell all the registered ObjectUsers that the page is in destruction
- sdr::ObjectUserVector aListCopy(mpImpl->maObjectUsers.begin(), mpImpl->maObjectUsers.end());
- for(sdr::ObjectUser* pObjectUser : aListCopy)
+ // Tell all the registered ObjectUsers that the page is in destruction.
+ // And clear the vector. This means that user do not need to call RemoveObjectUser()
+ // when they get called from ObjectInDestruction().
+ sdr::ObjectUserVector aList;
+ aList.swap(mpImpl->maObjectUsers);
+ for(sdr::ObjectUser* pObjectUser : aList)
{
DBG_ASSERT(pObjectUser, "SdrObject::~SdrObject: corrupt ObjectUser list (!)");
pObjectUser->ObjectInDestruction(*this);
}
- // Clear the vector. This means that user do not need to call RemoveObjectUser()
- // when they get called from ObjectInDestruction().
- mpImpl->maObjectUsers.clear();
-
// UserCall
SendUserCall(SdrUserCallType::Delete, GetLastBoundRect());
o3tl::reset_preserve_ptr_during(pPlusData);