[Libreoffice-commits] core.git: svx/source

Julien Nabet serval2412 at yahoo.fr
Sat Sep 9 17:37:38 UTC 2017


 svx/source/tbxctrls/tbcontrl.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit e40ba034fa01cc271ad0e1940f623e551793f80b
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Sep 9 00:47:20 2017 +0200

    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 <serval2412 at yahoo.fr>
    Tested-by: Julien Nabet <serval2412 at yahoo.fr>

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();


More information about the Libreoffice-commits mailing list