diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-01-07 10:59:19 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-01-07 11:14:27 +0100 |
commit | 0f6f21346ec989dc31130e6bdc196a2293fcbb2e (patch) | |
tree | 73d2aa47857997b6f427bcb619de8c8760115647 /editeng | |
parent | 85aa507f737b99501bb91cf79985af78f46ff0be (diff) |
Fix memory leak
This e.g. reduces the LSan-reported leakage during CppunitTest_sd_filters_test
from
SUMMARY: AddressSanitizer: 115048 byte(s) leaked in 4639 allocation(s).
to
SUMMARY: AddressSanitizer: 6544 byte(s) leaked in 118 allocation(s).
The history is that this happened to (presumably accidentally) get fixed when
switching from an SV_DECL_PTRARR to a boost::ptr_vector in
b35980d9b28f1e3985f94238f7d8c9962f654bd0 "Move away from SV_DECL_PTRARR in
CharAttribList" but then got "fixed" again with
46da0b6837bffa7d8a72624d2587159737e3d7e2 "further sc/editeng unbreaking." That
latter commit doesn't give any more detail than "this boost::ptr_vector idea is
seriously broken," but I assume it did that change only via code inspection, to
return to the previous (assumed good) status quo, rather than because that
recently introduced deletion actually caused any problems there.
I now see that this has also independently been found and fixed in AOO with
<https://bz.apache.org/ooo/show_bug.cgi?id=120865> "Part of EditAttrib objects
are not released after removing from Character attributes list" (the fix for
which apparently got mis-classified for LO as
"dd127fae0c5661e6488785ed0ecb410d81165a6e prefer:
e4e4b3d65788d14d5f10cd6bccc713cfe2411cb1," i.e., "Another SV_DECL_PTRARR now
gone" about some unrelated XBaseParaPortionList).
Change-Id: Iecee5a4c85bc0c0c36a6690d70f0a4a59dab964a
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 12 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.hxx | 1 |
2 files changed, 1 insertions, 12 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 9b484a3079f7..09f5f1f96492 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -2590,7 +2590,7 @@ void EditDoc::InsertAttrib( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd if ( pAttr ) { // Remove attribute.... - rAttrList.Release(pAttr); + rAttrList.Remove(pAttr); } // check whether 'the same' attribute exist at this place. @@ -2918,16 +2918,6 @@ void CharAttribList::Remove(sal_Int32 nPos) aAttribs.erase(aAttribs.begin()+nPos); } -void CharAttribList::Release(const EditCharAttrib* p) -{ - AttribsType::iterator it = std::find_if(aAttribs.begin(), aAttribs.end(), FindByAddress(p)); - if (it != aAttribs.end()) - { - it->release(); - aAttribs.erase(it); - } -} - void CharAttribList::SetHasEmptyAttribs(bool b) { bHasEmptyAttribs = b; diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index 5c419cd5c4a1..ebdfb09b70f3 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -225,7 +225,6 @@ public: void Remove(const EditCharAttrib* p); void Remove(sal_Int32 nPos); - void Release(const EditCharAttrib* p); #if OSL_DEBUG_LEVEL > 0 static void DbgCheckAttribs(CharAttribList const& rAttribs); |