Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


Sorry, I understand now that pItem->mpWindow is a smart pointer (VclPtr).
So the issue may be elsewhere.

Thanks,
Dennis

On Wed, Aug 26, 2015 at 3:42 PM, Dennis Francis <dennisfrancis.in@gmail.com>
wrote:

Hi Caolán and Maxim

Thanks for your replies, My reply is inline.

On Tue, Aug 25, 2015 at 7:38 PM, Caolán McNamara <caolanm@redhat.com>
wrote:

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

yes.


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 ?


I think it should work with writer too, I ran soffice --calc and opened a
new spreadsheet and then closed it.


C.


Here is what I observe in gdb :
===========================================================================
breakpoints were set on :
SvxFontNameBox_Impl::SvxFontNameBox_Impl()
SvxFontNameBox_Impl::FillList()
SvxFontNameBox_Impl::~SvxFontNameBox_Impl()

Order of calls observed from gdb each with address of SvxFontNameBox_Impl
object :
1. (SvxFontNameBox_Impl * const) 0x1cd4290,
SvxFontNameBox_Impl::SvxFontNameBox_Impl - from toolbar code
2. (SvxFontNameBox_Impl * const) 0x1cd4290, SvxFontNameBox_Impl::FillList
3. (SvxFontNameBox_Impl * const) 0x1e60cc0,
SvxFontNameBox_Impl::SvxFontNameBox_Impl  - from sidebar::ControllerFactory
4. (SvxFontNameBox_Impl * const) 0x1e60cc0,
SvxFontNameBox_Impl::~SvxFontNameBox_Impl - sidebar
5. (SvxFontNameBox_Impl * const) 0x1e60cc0,
SvxFontNameBox_Impl::~SvxFontNameBox_Impl - sidebar


No call of destructor SvxFontNameBox_Impl::~SvxFontNameBox_Impl() for the
instance 0x1cd4290

==============================================================================

I tried setting break point on
framework::ToolBarManager::RemoveControllers and it calls SetItemWindow(id,
0) for all items :
m_pToolBar->SetItemWindow(nItemId, 0);

But in ToolBox::SetItemWindow() method, I think the pItem->mpWindow is
just overwritten and not getting deleted. Is the deletion code missing here
?
Is it ok to add

 if (pItem->mpWindow)
    delete pItem->mpWindow;

before assigning pNewWindow to it ?


   1296 void ToolBox::SetItemWindow( sal_uInt16 nItemId, vcl::Window*
pNewWindow )
   1297 {
   1298     sal_uInt16 nPos = GetItemPos( nItemId );
   1299
   1300     if ( nPos != TOOLBOX_ITEM_NOTFOUND )
   1301     {
   1302         ImplToolItem* pItem = &mpData->m_aItems[nPos];
   1303        * pItem->mpWindow = pNewWindow;*
   1304         if ( pNewWindow )
   1305             pNewWindow->Hide();
   1306         ImplInvalidate( true );
   1307         CallEventListeners( VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED,
reinterpret_cast< void* >( nPos ) );
   1308     }
   1309 }

Thanks,
Dennis

http://www.ldcs.co.in


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.