Issue 113748

Summary: xmloff: When saving odp documents, many SvxUnoNumberingRules objects which are put into the pool leaks in xmloff module
Product: xml Reporter: zhang jianfang <zhangjf>
Component: codeAssignee: clippka
Status: CLOSED FIXED QA Contact: issues@xml <issues>
Severity: Trivial    
Priority: P3 CC: issues, Mathias_Bauer
Version: OOO310m11   
Target Milestone: 3.4.1   
Hardware: All   
OS: All   
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
fix code patch file (Based on OOo3.1M11 code) none

Description zhang jianfang 2010-08-09 13:38:14 UTC
The memory leak problem can be easily recreated by saving any .odp documents.
Depends on how many pages and styles, the leaked mmeory varies.

The SvxUnoNumberingRules are created with below call stack,

	svxmi!SvxUnoNumberingRules::SvxUnoNumberingRules+0000006D
(z:\impr\svx\source\unodraw\unonrule.cxx, 166)
	svxmi!SvxCreateNumRule+0000002E (z:\impr\svx\source\unodraw\unonrule.cxx, 622)
	svxmi!SvxUnoTextRangeBase::GetPropertyValueHelper+00000162
(z:\impr\svx\source\unoedit\unotext.cxx, 699)
	svxmi!SvxUnoTextRangeBase::getPropertyValue+00000487
(z:\impr\svx\source\unoedit\unotext.cxx, 671)
	svxmi!SvxUnoTextRangeBase::_getPropertyValues+00000272
(z:\impr\svx\source\unoedit\unotext.cxx, 965)
	svxmi!SvxUnoTextContent::getPropertyValues+0000002B
(z:\impr\svx\source\unoedit\unotext2.cxx, 350)
	xomi!MultiPropertySetHelper::getValues+0000002E
(z:\lib\xmloff\source\style\multipropertysethelper.cxx, 158)
	xomi!MultiPropertySetHelper::getValue+00000091
(z:\lib\xmloff\source\style\multipropertysethelper.cxx, 196)
	xomi!XMLTextParagraphExport::Add+00000158
(z:\lib\xmloff\source\text\txtparae.cxx, 397)
	xomi!XMLTextParagraphExport::exportParagraph+000001A6
(z:\lib\xmloff\source\text\txtparae.cxx, 2003)
	xomi!XMLTextParagraphExport::exportTextContentEnumeration+00000484
(z:\lib\xmloff\source\text\txtparae.cxx, 1897)
	xomi!XMLTextParagraphExport::exportText+00000277
(z:\lib\xmloff\source\text\txtparae.cxx, 1767)
	xomi!XMLShapeExport::collectShapeAutoStyles+0000059A
(z:\lib\xmloff\source\draw\shapeexport.cxx, 269)
	xomi!XMLShapeExport::collectShapesAutoStyles+000000E0
(z:\lib\xmloff\source\draw\shapeexport.cxx, 911)
	xomi!SdXMLExport::CollectDrawPageAutoStyles+00000341
(z:\lib\xmloff\source\draw\sdxmlexp.cxx, 2609)
	xomi!SdXMLExport::_ExportAutoStyles+00000E86
(z:\lib\xmloff\source\draw\sdxmlexp.cxx, 3431)
	xomi!SvXMLExport::ImplExportAutoStyles+000003DB
(z:\lib\xmloff\source\core\xmlexp.cxx, 1214)
	xomi!SvXMLExport::exportDoc+00000ED1 (z:\lib\xmloff\source\core\xmlexp.cxx, 1493)
	xomi!SdXMLExport::exportDoc+00000554 (z:\lib\xmloff\source\draw\sdxmlexp.cxx, 2395)
	xomi!SvXMLExport::filter+000001BC (z:\lib\xmloff\source\core\xmlexp.cxx, 941)
	sdmi!SdXMLFilter::Export+00002636 (z:\impr\sd\source\filter\xml\sdxmlwrp.cxx, 1235)
	sdmi!sd::DrawDocShell::SaveAs+0000085C
(z:\impr\sd\source\ui\docshell\docshel4.cxx, 683)
	sfxmi!SfxObjectShell::SaveAsOwnFormat+000000E2
(z:\lib\sfx2\source\doc\objstor.cxx, 3331)
	sdmi!sd::DrawDocShell::SaveAsOwnFormat+000001A1
(z:\impr\sd\source\ui\docshell\docshel4.cxx, 1253)
	sfxmi!SfxObjectShell::SaveTo_Impl+000012E4 (z:\lib\sfx2\source\doc\objstor.cxx,
1639)
	sfxmi!SfxObjectShell::PreDoSaveAs_Impl+0000031C
(z:\lib\sfx2\source\doc\objstor.cxx, 3028)
	sfxmi!SfxObjectShell::CommonSaveAs_Impl+000007E4
(z:\lib\sfx2\source\doc\objstor.cxx, 287


The root cause is the SvxUnoNumberingRules objects referred by
XMLTextListAutoStylePoolEntry_Impl objects, which is put into
XMLTextListAutoStylePool in api XMLTextListAutoStylePool::Add(),  but they are
not freed correctly when the pool object freed.


The fix is quite straightforward.
Comment 1 zhang jianfang 2010-08-09 13:38:38 UTC
Created attachment 71021 [details]
fix code patch file (Based on OOo3.1M11 code)
Comment 2 zhang jianfang 2010-08-09 13:40:27 UTC
XMLTextListAutoStylePool.pNames may also have leaks, but don't know the
condition to make it happen.  You may have a check too.
Comment 3 Mathias_Bauer 2010-08-19 17:18:09 UTC
Christian, please take over
Comment 4 clippka 2010-10-11 14:56:26 UTC
zhangjfibm, nice catch, thanks for the contribution

XMLTextListAutoStylePool.pNames also leaks but it is only used in writer
documents with bullets in paragraphs. I fixed this accordingly

patch applied to cws impress202

Comment 5 sven.jacobi 2010-11-05 13:47:36 UTC
changed target
Comment 6 sven.jacobi 2010-11-16 11:55:31 UTC
sj: the bugfix looks good -> verified
Comment 7 clippka 2011-01-24 09:24:03 UTC
closing integrated issue