summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2020-10-29 17:22:03 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2020-10-29 19:51:49 +0100
commitd11e6edec3116f647fa085a297e29c677f5b8662 (patch)
tree5c426df368cbd869933603fa198ee2cc3805fa47 /svtools
parent3e2290c55c23c0785763f8de51eba749ab622900 (diff)
tdf#132536 free the cached VirtualDevices
Once again I forgot, that VclPtr is not really a shared pointer, as someone has to release the contained instance. It just prevents others from working on a dangling pointer and also freeing the contained instance multiple times. Using a "Scoped" variant in the vector instead of the loop doesn't compile. This fixes the major memory leak when deleting the last FontNameBox, which freed the caching VclPtr vector but not the contained VirtualDevice instances. It seems there is still some other minor leak left to fix, probably unrelated to the regressing patch. Found, after I realized the memory leak just happened with font preview enabled... Regressed-by: 2e0a32b51681fb356699b4a722f461f55a46b890 Change-Id: Ic0c60cd31bb6dabf03b0f8bd232390e784421588 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105017 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/control/ctrlbox.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index cc7f1c699069..4a0210cde5bd 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -392,6 +392,8 @@ FontNameBox::~FontNameBox()
--gFontNameBoxes;
if (!gFontNameBoxes)
{
+ for (auto &rDev : gFontPreviewVirDevs)
+ rDev.disposeAndClear();
gFontPreviewVirDevs.clear();
gRenderedFontNames.clear();
}