Deletion of vcl::Window's inside ToolBar

Michael Meeks michael.meeks at collabora.com
Mon Aug 31 00:12:05 PDT 2015


Hi Dennis,

On Fri, 2015-08-28 at 09:28 +0530, Dennis Francis wrote:
> I tried calling disposeAndClear() on mpWindow but the object remains
> intact with a lower mnRefCnt of 207. After putting address of
> mnRefCount on gdb watch,

	Heh =)

> it was clear that ref counts gets added for each font added to the
> font list box widget while calling the constructor of
> ImplFontListFontInfo.
> In ImplFontListFontInfo the OutputDevice is held inside VclPtr wrapper
> (mpDevice) which is never released.

	Right. So - what we need to do is to add code to the 'dispose' method
of whatever is holding these handles to clear the references. The root
problem is that the widget holding those is not clearing up its own
references properly in dispose.

	So - there is some deepish nesting here AFAICS - all of which needs
some simple cleanup methods.

	ImplFontListFontInfo needs a dispose method that does:
		mpDevice.clear();

	ImplFontListNameInfo needs a dispose method that walks its
		list of ImplFontListFontInfo (via mpFirst I guess)
		calling dispose() on those.

	FontList needs a dispose method
		disposing each of its ptr_vector members
		also 'clear()' ing each of it's mpDev, mpDev2 members

	And we of course need to dispose the FontList whereever it is
instantiated in a widget: eventually we'll have to hit a 'dispose'
method going up the tree.

	Is that feasible ?

	Thanks so much for chasing this one Dennis !

	ATB,

		Michael.

-- 
 michael.meeks at collabora.com  <><, Pseudo Engineer, itinerant idiot



More information about the LibreOffice mailing list