diff options
author | Armin Le Grand <alg@apache.org> | 2012-06-26 12:36:31 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-04-10 20:17:30 +0100 |
commit | 858c6610f3476bb47bb7b4e621a7ac48a9e34a75 (patch) | |
tree | 8eb898f314aa3c3099b6b2359a2bf8c52e1651dd /sc | |
parent | a6f169433ada74a81b2e3421ea9c68a36c821fbb (diff) |
Resolves: #i120077# Memory leak fixed in ScXMLFontAutoStylePool_Impl
also checked and fixed memory leaks caused by not deleting
SfxStyleSheetIterator instances.
Found by: Chao Huang
Patch by: Chao Huang
Review by: alg
(cherry picked from commit aee8221b3fbe64d8e88aa3a1b630214807cd86f0)
Conflicts:
sc/source/core/data/stlsheet.cxx
sc/source/filter/xml/xmlfonte.cxx
sfx2/source/doc/objcont.cxx
svl/source/items/style.cxx
sw/source/core/unocore/unostyle.cxx
Resolves: #120077# ALG: Reverted r1354011,
adapted all usages of SfxStyleSheetIterator and CreateIterator to use
boost::shared_ptr
(cherry picked from commit ec1819f218b94bed1556653e1b2b816a65da61ef)
Conflicts:
sc/source/core/data/stlsheet.cxx
sc/source/filter/xml/xmlfonte.cxx
sfx2/source/doc/objcont.cxx
svl/inc/svl/style.hxx
svl/source/items/style.cxx
sw/source/core/unocore/unoframe.cxx
sw/source/core/unocore/unostyle.cxx
26937d4d65562b14de0aea59a7b01cc4334f73c1
Change-Id: If99bf3ee399292ec269d68b36ee78ed63f033215
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/patattr.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/stlsheet.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlfonte.cxx | 8 |
3 files changed, 10 insertions, 5 deletions
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index a391ad136831..af1d5c9e6f8d 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -1161,9 +1161,8 @@ void ScPatternAttr::UpdateStyleSheet() //! es wird vorausgesetzt, dass "Standard" immer der erste Eintrag ist! if (!pStyle) { - SfxStyleSheetIterator* pIter = pDoc->GetStyleSheetPool()->CreateIterator( - SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL ); - pStyle = (ScStyleSheet*)pIter->First(); + SfxStyleSheetIteratorPtr pIter = pDoc->GetStyleSheetPool()->CreateIterator( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL ); + pStyle = dynamic_cast< ScStyleSheet* >(pIter->First()); } if (pStyle) diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index 3ef1b42b9c76..eaa692a798cc 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -109,7 +109,7 @@ bool ScStyleSheet::SetParent( const String& rParentName ) SfxStyleSheetBase* pStyle = pPool->Find( aEffName, nFamily ); if (!pStyle) { - SfxStyleSheetIterator* pIter = pPool->CreateIterator( nFamily, SFXSTYLEBIT_ALL ); + SfxStyleSheetIteratorPtr pIter = pPool->CreateIterator( nFamily, SFXSTYLEBIT_ALL ); pStyle = pIter->First(); if (pStyle) aEffName = pStyle->GetName(); diff --git a/sc/source/filter/xml/xmlfonte.cxx b/sc/source/filter/xml/xmlfonte.cxx index 4092bfa18dfd..9b0c263c7c3f 100644 --- a/sc/source/filter/xml/xmlfonte.cxx +++ b/sc/source/filter/xml/xmlfonte.cxx @@ -82,7 +82,13 @@ ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl( const SfxItemPool* pEditPool(rExportP.GetDocument()->GetEditPool()); AddFontItems(aEditWhichIds, 3, pEditPool, false); - SfxStyleSheetIterator* pItr(rExportP.GetDocument() ? rExportP.GetDocument()->GetStyleSheetPool()->CreateIterator(SFX_STYLE_FAMILY_PAGE, 0xFFFF) : NULL); + SfxStyleSheetIteratorPtr pItr; + + if(rExportP.GetDocument()) + { + pItr = rExportP.GetDocument()->GetStyleSheetPool()->CreateIterator(SFX_STYLE_FAMILY_PAGE, 0xFFFF); + } + if(pItr) { SfxStyleSheetBase* pStyle(pItr->First()); |