summaryrefslogtreecommitdiff
path: root/vcl/headless
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-08-28 08:53:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-08-28 11:20:20 +0200
commit9bd3482c933a611f428fce76a0d1a10dd0d4353a (patch)
treeff87201cb2fc82342c410776838688fcd3666ffe /vcl/headless
parent4e298b48d5822acf626d2f664181efdc601b8cd4 (diff)
ofz#3092 Direct-leak
Change-Id: Ib10bd9bd2e6e712cb0a9c1906600543f786d7f53 Reviewed-on: https://gerrit.libreoffice.org/41618 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/headless')
-rw-r--r--vcl/headless/svpgdi.cxx9
1 files changed, 8 insertions, 1 deletions
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)