[Libreoffice-commits] core.git: svx/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Fri Feb 7 11:37:21 UTC 2020
svx/source/svdraw/svdobj.cxx | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
New commits:
commit dd9434929e507e5989bed94bbafe4fe891bf6c22
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Feb 7 09:10:31 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Feb 7 12:36:45 2020 +0100
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 at collabora.co.uk>
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);
More information about the Libreoffice-commits
mailing list