Deletion of vcl::Window's inside ToolBar

Michael Meeks michael.meeks at collabora.com
Wed Aug 26 05:50:45 PDT 2015


Hi Dennis,

On Wed, 2015-08-26 at 17:59 +0530, Dennis Francis wrote:
> After entering ToolBarManager::RemoveControllers, I put a break point
> on SvxFontNameBox_Impl::~SvxFontNameBox_Impl and then did
> mpWindow.clear() in gdb (where mpWindow is the SvxFontNameBox_Impl
> object wrapped in VclPtr).

	Interesting. Is it possible that there should be a disposeAndClear
there ?

> But gdb did not show a call on the dtor ~SvxFontNameBox_Impl. After
> further digging, I found that the mnRefCnt of the mpWindow in question
> was 219 just before the VclPtr was reset.

	So - for a given un-disposed window - I'd expect lots of VclPtr
references - but its unusual to have that many.

> Now I wonder who else increased the ref count of this mpWindow object,
> why the value is so high and how to proceed from here ?

	VCL itself maintains a whole slew of these - eg. the impl. of a window
points to the next window, the previous window, top-levels are
maintained in lists left & right etc. parents hold references to
children and vv. (depends how many children it has).

	In order to (hopefully) break all these referencing cycles - it is
necessary to call 'disposeOnce' or 'disposeAndClear' on the VclPtr -
which stats the process of tidying up all the references.

	I miss the context but reading vcl/README.lifecycle would
probably be helpful.

	HTH,

		Michael.

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



More information about the LibreOffice mailing list