[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - 2 commits - basic/source unotools/source vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/source vcl/unx

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 21 14:22:46 UTC 2019


 basic/source/basmgr/basicmanagerrepository.cxx |    6 +++++-
 unotools/source/misc/eventlisteneradapter.cxx  |    3 +--
 vcl/headless/svpgdi.cxx                        |    1 +
 vcl/inc/textrender.hxx                         |    2 ++
 vcl/inc/unx/cairotextrender.hxx                |    4 +---
 vcl/qt5/Qt5Graphics.cxx                        |   11 +----------
 vcl/quartz/salgdi.cxx                          |    7 +------
 vcl/source/gdi/salgdilayout.cxx                |    1 +
 vcl/unx/generic/gdi/cairotextrender.cxx        |   12 ++++++------
 9 files changed, 19 insertions(+), 28 deletions(-)

New commits:
commit fb65014f61957bb0e7cf9008b38322ef14e707d6
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Wed Nov 20 12:18:39 2019 +0000
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Nov 21 15:21:43 2019 +0100

    tdf#128434 free the BasicManager event listener
    
    This gets rid of the last 72 lost bytes I could identify in the
    huge valgrind logs to look like its PDF generation related.
    
    Change-Id: Idda3c2c5b7f5ce0211199b86503037b74438ccf2
    Reviewed-on: https://gerrit.libreoffice.org/83302
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit 48b23bbfa0271ed327f668933b92d2ae9b99e806)
    Reviewed-on: https://gerrit.libreoffice.org/83350
    (cherry picked from commit d8cde1cf69bb170da74018e629e1b65830924e0b)
    Reviewed-on: https://gerrit.libreoffice.org/83370
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index b725f0563a3c..9ef667aa6c11 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -538,12 +538,16 @@ namespace basic
         OSL_PRECOND( _pos != m_aStore.end(), "ImplRepository::impl_removeFromRepository: invalid position!" );
 
         std::unique_ptr<BasicManager> pManager = std::move(_pos->second);
+        Reference<XModel> xModel(_pos->first, UNO_QUERY);
 
         // *first* remove from map (else Notify won't work properly)
         m_aStore.erase( _pos );
 
-        // *then* delete the BasicManager
         EndListening( *pManager );
+
+        assert(xModel.is());
+        if (xModel.is())
+            stopComponentListening(xModel);
     }
 
 
diff --git a/unotools/source/misc/eventlisteneradapter.cxx b/unotools/source/misc/eventlisteneradapter.cxx
index ac3dbe9c615e..c9f6b6f73ee9 100644
--- a/unotools/source/misc/eventlisteneradapter.cxx
+++ b/unotools/source/misc/eventlisteneradapter.cxx
@@ -84,7 +84,6 @@ namespace utl
     {
         Reference< XEventListener > xDeleteUponLeaving = m_xKeepMeAlive;
         m_xKeepMeAlive.clear();
-        m_xComponent.clear();
 
         m_pAdapter->_disposing(_rSource);
     }
@@ -118,7 +117,7 @@ namespace utl
         do
         {
             rtl::Reference<OEventListenerImpl>& pListenerImpl = *it;
-            if ( pListenerImpl->getComponent().get() == _rxComp.get() )
+            if ((pListenerImpl->getComponent().get() == _rxComp.get()) || (pListenerImpl->getComponent() == _rxComp))
             {
                 pListenerImpl->dispose();
                 it = m_pImpl->aListeners.erase( it );
commit 41f2ec60825bc71686f506178733a885373d6ddb
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Mon Nov 18 16:04:24 2019 +0000
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Nov 21 15:21:22 2019 +0100

    tdf#128434 correctly release fonts in destructors
    
    This adds ReleaseFonts() calls to all destructors of SalGraphics
    and TextRenderImpl derivated classes, which implement SetFont.
    
    During destruction a base class can't call into derivated classes,
    as these are already destructed, so we have to spread these calls
    manually.
    
    Change-Id: Ia57db04f7df665e5205212ce512119e2f60e3379
    Reviewed-on: https://gerrit.libreoffice.org/82967
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit f8e1f8652255cadd80a991aa3e059ee631b333b8)
    Reviewed-on: https://gerrit.libreoffice.org/83149
    (cherry picked from commit a00bdc999344db34d5926dc77ed5ca895295b0ee)
    Reviewed-on: https://gerrit.libreoffice.org/83197
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 467de73597e6..8a445b2f209a 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -607,6 +607,7 @@ SvpSalGraphics::SvpSalGraphics()
 
 SvpSalGraphics::~SvpSalGraphics()
 {
+    ReleaseFonts();
 }
 
 void SvpSalGraphics::setSurface(cairo_surface_t* pSurface, const basegfx::B2IVector& rSize)
diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
index 063b5d4462b2..99360a5521b2 100644
--- a/vcl/inc/textrender.hxx
+++ b/vcl/inc/textrender.hxx
@@ -32,10 +32,12 @@ class PhysicalFontFace;
 class TextRenderImpl
 {
 public:
+    // can't call ReleaseFonts here, as the destructor just calls this classes SetFont (pure virtual)!
     virtual ~TextRenderImpl() {}
 
     virtual void                    SetTextColor( Color nColor ) = 0;
     virtual void                    SetFont(LogicalFontInstance*, int nFallbackLevel) = 0;
+    void ReleaseFonts() { SetFont(nullptr, 0); }
     virtual void                    GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) = 0;
     virtual const FontCharMapRef    GetFontCharMap() const = 0;
     virtual bool                    GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const = 0;
diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx
index ca9cfcd8da80..6b011a01874e 100644
--- a/vcl/inc/unx/cairotextrender.hxx
+++ b/vcl/inc/unx/cairotextrender.hxx
@@ -42,13 +42,11 @@ protected:
     virtual void                getSurfaceOffset(double& nDX, double& nDY) = 0;
     virtual void                releaseCairoContext(cairo_t* cr) = 0;
 
-    void                        setFont(LogicalFontInstance *pEntry, int nFallbackLevel);
-
     virtual void                clipRegion(cairo_t* cr) = 0;
 
 public:
                                 CairoTextRender();
-
+    virtual ~CairoTextRender() override;
 
     virtual void                SetTextColor( Color nColor ) override;
     virtual void                SetFont(LogicalFontInstance*, int nFallbackLevel) override;
diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx
index 5192f0b42416..8228699a2602 100644
--- a/vcl/qt5/Qt5Graphics.cxx
+++ b/vcl/qt5/Qt5Graphics.cxx
@@ -44,16 +44,7 @@ Qt5Graphics::Qt5Graphics( Qt5Frame *pFrame, QImage *pQImage )
         m_pWidgetDraw.reset(new Qt5Graphics_Controls());
 }
 
-Qt5Graphics::~Qt5Graphics()
-{
-    // release the text styles
-    for (int i = 0; i < MAX_FALLBACK; ++i)
-    {
-        if (!m_pTextStyle[i])
-            break;
-        m_pTextStyle[i].clear();
-    }
-}
+Qt5Graphics::~Qt5Graphics() { ReleaseFonts(); }
 
 void Qt5Graphics::ChangeQImage(QImage* pQImage)
 {
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 846b7abbbc49..8d7308fd70cc 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -223,12 +223,7 @@ AquaSalGraphics::~AquaSalGraphics()
         CGPathRelease( mxClipPath );
     }
 
-    for (int i = 0; i < MAX_FALLBACK; ++i)
-    {
-        if (!mpTextStyle[i])
-            break;
-        mpTextStyle[i].clear();
-    }
+    ReleaseFonts();
 
     if( mpXorEmulation )
         delete mpXorEmulation;
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 789e323f33de..97ba1aa656f0 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -83,6 +83,7 @@ bool SalGraphics::initWidgetDrawBackends(bool bForce)
 
 SalGraphics::~SalGraphics()
 {
+    // can't call ReleaseFonts here, as the destructor just calls this classes SetFont (pure virtual)!
 }
 
 #if HAVE_FEATURE_OPENGL
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index aa006fa7c5d3..087135652c07 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -84,7 +84,12 @@ CairoTextRender::CairoTextRender()
         rp = nullptr;
 }
 
-void CairoTextRender::setFont(LogicalFontInstance *pEntry, int nFallbackLevel)
+CairoTextRender::~CairoTextRender()
+{
+    ReleaseFonts();
+}
+
+void CairoTextRender::SetFont(LogicalFontInstance *pEntry, int nFallbackLevel)
 {
     // release all no longer needed font resources
     for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i )
@@ -384,11 +389,6 @@ bool CairoTextRender::GetFontCapabilities(vcl::FontCapabilities &rGetImplFontCap
 
 // SalGraphics
 
-void CairoTextRender::SetFont(LogicalFontInstance *pEntry, int nFallbackLevel)
-{
-    setFont(pEntry, nFallbackLevel);
-}
-
 void
 CairoTextRender::SetTextColor( Color nColor )
 {


More information about the Libreoffice-commits mailing list