diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-07-27 16:04:07 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-07-30 17:52:30 +0200 |
commit | f0dcfe008d58053e52c51b10e51c58eae27c1f0b (patch) | |
tree | 1e5b359120d501a7d4acb6051204c3ee5ce30add /svx/source/svdraw/svdmodel.cxx | |
parent | e1d73cb5552c2566c6d7463ce001e555523f3d92 (diff) |
Added SdrObjectLifetimeWatchDog for debug mode
Change-Id: I79f65b7511d400c3e7071e45c3f0b1d385bcd8d4
Reviewed-on: https://gerrit.libreoffice.org/58197
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'svx/source/svdraw/svdmodel.cxx')
-rw-r--r-- | svx/source/svdraw/svdmodel.cxx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 2761af39bea4..a63401dc88e7 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -204,7 +204,12 @@ void SdrModel::ImpCtor( SdrModel::SdrModel( SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers) -: maMaPag(), +: +#ifdef DBG_UTIL + // SdrObjectLifetimeWatchDog: + maAllIncarnatedObjects(), +#endif + maMaPag(), maPages() { ImpCtor(pPool,pPers); @@ -228,6 +233,21 @@ SdrModel::~SdrModel() ClearModel(true); +#ifdef DBG_UTIL + // SdrObjectLifetimeWatchDog: + if(!maAllIncarnatedObjects.empty()) + { + SAL_WARN("svx","SdrModel::~SdrModel: Not all incarnations of SdrObjects deleted, possible memory leak (!)"); + // copy to std::vector - calling SdrObject::Free will change maAllIncarnatedObjects + const std::vector< const SdrObject* > maRemainingObjects(maAllIncarnatedObjects.begin(), maAllIncarnatedObjects.end()); + for(auto pSdrObject : maRemainingObjects) + { + SdrObject* pCandidate(const_cast<SdrObject*>(pSdrObject)); + SdrObject::Free(pCandidate); + } + } +#endif + pLayerAdmin.reset(); pTextChain.reset(); |