[Libreoffice-commits] core.git: sfx2/source
Mark Wielaard
mark at klomp.org
Tue May 21 02:41:51 PDT 2013
sfx2/source/bastyp/fltfnc.cxx | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
New commits:
commit a6a8c379b20b4de7e8715057af4c1f6d020e55d2
Author: Mark Wielaard <mark at klomp.org>
Date: Tue May 21 09:55:03 2013 +0200
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
Reviewed-on: https://gerrit.libreoffice.org/3989
Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
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 @@ public:
, 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 @@ namespace
// 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;
More information about the Libreoffice-commits
mailing list