incubator-ooo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 120077] There are some memory leaks in function ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl
Date Fri, 29 Jun 2012 02:50:29 GMT
https://issues.apache.org/ooo/show_bug.cgi?id=120077

--- Comment #16 from ChaoHuang <chao.dev.h@gmail.com> ---
(In reply to comment #12)
> (In reply to comment #10)
> > ALG: in principle, the whole SfxStyleSheetBasePool::CreateIterator is not
> > needed; a SfxStyleSheetIterator can be created by everyone
> 

confirmed the issue. Thanks for your testing and reporting!

> This breaks the styles in Writer:
> 
> - Create a new Writer document
> - Press F11
> - There are no styles for any style family
> 
> ----------------------------------------------------------------
> The UNO layer is affected too.
> Run the following macro:
> 
> REM  *****  BASIC  *****
> 
> Option Explicit
> 
> Sub Main
> 	Dim oDoc as Object
> 	oDoc = ThisComponent
> 	
> 	Dim sStyleFamilies$()
> 	Dim oStyleFamilies as Object
> 	oStyleFamilies = oDoc.getStyleFamilies()
> 	sStyleFamilies = oStyleFamilies.getElementNames()
> 	
> 	Dim sStyleFamily$
> 	Dim oFamily as Object
> 	For Each sStyleFamily in sStyleFamilies
> 		oFamily = oStyleFamilies.getByName(sStyleFamily)
> 		
> 		Dim sStyleNames$()
> 		Dim sStyle$, sStyleName$
> 		Dim oStyle as Object
> 		sStyleNames = oFamily.getElementNames()
> 		For Each sStyle In sStyleNames
> 			oStyle = oFamily.getByName(sStyle)
> 			sStyleName = oStyle.Name
> 		Next
> 	Next
> End Sub
> 
> Style families are empty
> 
> ----------------------------------------------------------------
> 
> You cannot simply replace SfxStyleSheetBasePool::CreateIterator with
> creating a SfxStyleSheetIterator.
> Writer sub-classes SfxStyleSheetBasePool in SwDocStyleSheetPool and
> overrides this function to return an SwStyleSheetIterator, derived from
> SfxStyleSheetIterator; and obviously SfxStyleSheetIterator and
> SwStyleSheetIterator are not exchangeable (without breaking functionality,
> like in this case).
> 
> This happens in SwXStyleFamily::getElementNames(), where the pBasePool is
> likely (== I didn't debug this code) an SwDocStyleSheetPool and the iterator
> should be a SwStyleSheetIterator, not a SfxStyleSheetIterator. This is why
> the UNO layer is broken.
> 
> And it happens in the "Style and Formatting" window, in all the code in
> sfx2/source/dialog/templdlg.cxx the SfxStyleSheetBasePool is really a
> SwDocStyleSheetPool when we have a Writer document:
> 
> in void SfxCommonTemplateDialog_Impl::Update_Impl() 
> - SfxObjectShell is really a SwDocShell
> - pDocShell->GetStyleSheetPool() will be returning an SwDocStyleSheetPool
> (SfxStyleSheetBasePool*	SwDocShell::GetStyleSheetPool())
> - this means SfxStyleSheetBasePool::GetIterator_Impl cannot simply create a
> SfxStyleSheetIterator, and CreateIterator was there with the idea to return
> a SwDocStyleSheetPool in this case.

Thanks for your analysis ! It's very useful for us to solver the problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Mime
View raw message