vcl/source/app/svdata.cxx | 8 ++++++-- vcl/source/app/svmain.cxx | 8 +------- 2 files changed, 7 insertions(+), 9 deletions(-)
New commits: commit 2642ae3c7ddc188496e19d8e4a024b3403fdd86e Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Fri Jun 9 12:17:36 2023 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Jun 12 18:39:52 2023 +0200 trimMemory - fix crash modifying structure during clear. Re-use existing code from shutdown, to avoid ~Bitmap mutating maScaleCache while we're iterating it inside clear. Change-Id: I021d9075cf5c449702af091c2c8a4de64887f2ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152769 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.me...@collabora.com> (cherry picked from commit 6fc48879f8347a53a5ef1bf801fab831be3310f2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152884 diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index ac1fd6b2c623..9840eec37fc6 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -420,9 +420,13 @@ ImplSVData::ImplSVData() void ImplSVData::dropCaches() { - maGDIData.maScaleCache.clear(); - maGDIData.maThemeImageCache.clear(); + // we are iterating over a map and doing erase while inside a loop which is doing erase + // hence we can't use clear() here + maGDIData.maScaleCache.remove_if([](const lru_scale_cache::key_value_pair_t&) + { return true; }); + maGDIData.maThemeDrawCommandsCache.clear(); + maGDIData.maThemeImageCache.clear(); } void ImplSVData::dumpState(rtl::OStringBuffer &rState) diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 5bccf3e3a0c4..b574873744ee 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -589,13 +589,7 @@ void DeInitVCL() pSVData->maGDIData.mxScreenFontList.reset(); pSVData->maGDIData.mxScreenFontCache.reset(); - // we are iterating over a map and doing erase while inside a loop which is doing erase - // hence we can't use clear() here - pSVData->maGDIData.maScaleCache.remove_if([](const lru_scale_cache::key_value_pair_t&) - { return true; }); - - pSVData->maGDIData.maThemeDrawCommandsCache.clear(); - pSVData->maGDIData.maThemeImageCache.clear(); + pSVData->dropCaches(); comphelper::AccessibleEventNotifier::shutdown();