[Libreoffice-commits] core.git: svtools/source

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 29 18:52:32 UTC 2020


 svtools/source/control/ctrlbox.cxx |    2 ++
 1 file changed, 2 insertions(+)

New commits:
commit d11e6edec3116f647fa085a297e29c677f5b8662
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Thu Oct 29 17:22:03 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Oct 29 19:51:49 2020 +0100

    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 at fbihome.de>

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();
     }


More information about the Libreoffice-commits mailing list