[Libreoffice-commits] core.git: vcl/headless

Caolán McNamara caolanm at redhat.com
Mon Aug 28 09:24:02 UTC 2017


 vcl/headless/svpgdi.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 9bd3482c933a611f428fce76a0d1a10dd0d4353a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Aug 28 08:53:11 2017 +0100

    ofz#3092 Direct-leak
    
    Change-Id: Ib10bd9bd2e6e712cb0a9c1906600543f786d7f53
    Reviewed-on: https://gerrit.libreoffice.org/41618
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 98af7f417062..ce01c4e89230 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -1349,9 +1349,16 @@ cairo_user_data_key_t* SvpSalGraphics::getDamageKey()
 
 void SvpSalGraphics::releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, const basegfx::B2DRange& rExtents) const
 {
+    const bool bXoring = (m_ePaintMode == PaintMode::Xor && bXorModeAllowed);
+
     if (rExtents.isEmpty())
     {
         //nothing changed, return early
+        if (bXoring)
+        {
+            cairo_surface_t* surface = cairo_get_target(cr);
+            cairo_surface_destroy(surface);
+        }
         cairo_destroy(cr);
         return;
     }
@@ -1371,7 +1378,7 @@ void SvpSalGraphics::releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, cons
     //For the most part we avoid the use of XOR these days, but there
     //are some edge cases where legacy stuff still supports it, so
     //emulate it (slowly) here.
-    if (m_ePaintMode == PaintMode::Xor && bXorModeAllowed)
+    if (bXoring)
     {
         cairo_surface_t* target_surface = m_pSurface;
         if (cairo_surface_get_type(target_surface) != CAIRO_SURFACE_TYPE_IMAGE)


More information about the Libreoffice-commits mailing list