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

New commits:
commit 25f8e4c43d8a083199077256ee6d7430d29d0ae3
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Thu Oct 29 17:22:03 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Oct 29 21:50:10 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 <glo...@fbihome.de>
    (cherry picked from commit d11e6edec3116f647fa085a297e29c677f5b8662)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104961
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svtools/source/control/ctrlbox.cxx 
b/svtools/source/control/ctrlbox.cxx
index 555d35a94aa0..4a57f2e5b7fe 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -359,6 +359,8 @@ FontNameBox::~FontNameBox()
     --gFontNameBoxes;
     if (!gFontNameBoxes)
     {
+        for (auto &rDev : gFontPreviewVirDevs)
+            rDev.disposeAndClear();
         gFontPreviewVirDevs.clear();
         gRenderedFontNames.clear();
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to