Deletion of vcl::Window's inside ToolBar

Caolán McNamara caolanm at redhat.com
Tue Aug 25 07:08:36 PDT 2015


On Fri, 2015-08-21 at 23:51 +0530, Dennis Francis wrote:
> Hi all,
> 
> I am trying to understand where the SvxFontNameBox_Impl objects are 
> deallocated. With help from 
> gdb and opengrok, I found that it is held in ImplToolItem::mpWindow. 
> But in ImplToolItem destructor it says clearly not to remove mpWindow 
> as a comment.

> 
> ImplToolItem::~ImplToolItem() { 
> // don't dispose mpWindow - we get copied around.
> }

Digging into the other examples, I guess that SetItemWindow was called
on the toolbar with the SvxFontNameBox_Impl window as an argument ?

If that's the case then the pattern appears to be that what object
called SetItemWindow on the toolbar should call SetItemWindow(id, 0) to
remove the window from the toolbar and then call disposeAndClear on the
window.

i.e. what entity put the item into the toolbar is the same entity that
has to remove it and dispose it.

What's the reproducing scenario here, is it the fontname widget in the
standard toolbar, e.g. just start and exit writer to reproduce ?

C.


More information about the LibreOffice mailing list