Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3989

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/89/3989/1

Fix two SfxFilterMatcher_Impl memory leaks.

First SfxFilterMatcher_Impl::InitForIterating() will set pList to either
the global filter array matcher pFilterArr, or to a new SfxFilterList_Impl.
This new SfxFilterList_Impl should be deleted in the destructor.

Second getSfxFilterMatcher_Impl() keeps a cache of SfxFilterMatcher_Impls.
If a SfxFilterMatcher_Impl for a given name doesn't exist yet a new one
will be created. But the cache stored objects by service name (aName), but
looked object up by factory name (rName). So it always created a new
SfxFilterMatcher_Impl instead of using the one from the aImplArr cache.

Change-Id: I7840aaddc861f609fbe14d5b6c0ea20d997f690f
---
M sfx2/source/bastyp/fltfnc.cxx
1 file changed, 9 insertions(+), 1 deletion(-)



diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 8d9a70c..42477d0 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -255,6 +255,14 @@
         , pList(0)
     {
     }
+    ~SfxFilterMatcher_Impl()
+    {
+        // SfxFilterMatcher_Impl::InitForIterating() will set pList to
+        // either the global filter array matcher pFilterArr, or to
+        // a new SfxFilterList_Impl.
+        if (pList != pFilterArr)
+            delete pList;
+    }
 };
 
 namespace
@@ -287,7 +295,7 @@
         // previously
         SfxFilterMatcherArr_Impl::iterator aEnd = aImplArr.end();
         SfxFilterMatcherArr_Impl::iterator aIter =
-            std::find_if(aImplArr.begin(), aEnd, hasName(rName));
+            std::find_if(aImplArr.begin(), aEnd, hasName(aName));
         if (aIter != aEnd)
             return *aIter;
 

-- 
To view, visit https://gerrit.libreoffice.org/3989
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7840aaddc861f609fbe14d5b6c0ea20d997f690f
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Mark Wielaard <mark@klomp.org>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.