From e40ba034fa01cc271ad0e1940f623e551793f80b Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 9 Sep 2017 00:47:20 +0200 Subject: tdf#111894: fix leak memory with PaletteManager with SvxColorListBox m_xColorWindow is made with m_xPaletteManager so reset this last one before disposeAndClear first one By tracing constructor/destructor of PaletteManager, it seems there's no need to call m_xColorWindow.disposeAndClear() in SetSlotId. Change-Id: Ib3c236f8fd7fd12aaa86389f5c4c26fe58ba833e Reviewed-on: https://gerrit.libreoffice.org/42121 Reviewed-by: Julien Nabet Tested-by: Julien Nabet --- svx/source/tbxctrls/tbcontrl.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index dc5ccfee8339..fb7dd79a2422 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -3237,7 +3237,6 @@ void SvxColorListBox::SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton) { m_nSlotId = nSlotId; m_bShowNoneButton = bShowNoneButton; - m_xColorWindow.disposeAndClear(); m_aSelectedColor = bShowNoneButton ? GetNoneColor() : GetAutoColor(m_nSlotId); ShowPreview(m_aSelectedColor); createColorWindow(); @@ -3347,6 +3346,11 @@ SvxColorListBox::~SvxColorListBox() void SvxColorListBox::dispose() { + // TODO: reset should be made automatically but... + // tdf#111894: avoid memory leak with PaletteManager with SvxColorListBox + // m_xColorWindow is made with m_xPaletteManager + // so reset this last one before disposeAndClear first one + m_xPaletteManager.reset(); m_xColorWindow.disposeAndClear(); m_aColorWrapper.dispose(); MenuButton::dispose(); -- cgit