[gtk-osx] Fix memory leak in cairo-1.17.6



commit 4914c8e17741a5311b70897bd0315105fdddb84c
Author: John Ralls <jralls ceridwen us>
Date:   Thu Apr 28 15:30:39 2022 -0700

    Fix memory leak in cairo-1.17.6

 modulesets-stable/gtk-osx.modules               |  1 +
 patches/cairo-1.17.6-snapshot-memory-leak.patch | 27 +++++++++++++++++++
 patches/cairo-image-refcount.patch              | 36 -------------------------
 3 files changed, 28 insertions(+), 36 deletions(-)
---
diff --git a/modulesets-stable/gtk-osx.modules b/modulesets-stable/gtk-osx.modules
index 5cd349a..24a8251 100644
--- a/modulesets-stable/gtk-osx.modules
+++ b/modulesets-stable/gtk-osx.modules
@@ -167,6 +167,7 @@
     <branch module="1.17.6/cairo-1.17.6.tar.bz2"  version="1.17.6"
             repo="cairographics-temp"
             hash="sha256:90496d135c9ef7612c98f8ee358390cdec0825534573778a896ea021155599d2">
+      <patch file="cairo-1.17.6-snapshot-memory-leak.patch" strip="1"/>
     </branch>
     <dependencies>
       <dep package="pixman"/>
diff --git a/patches/cairo-1.17.6-snapshot-memory-leak.patch b/patches/cairo-1.17.6-snapshot-memory-leak.patch
new file mode 100644
index 0000000..3c10fe7
--- /dev/null
+++ b/patches/cairo-1.17.6-snapshot-memory-leak.patch
@@ -0,0 +1,27 @@
+From 243938c61a08dac8911153352e55933e0618581e Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls ceridwen us>
+Date: Sat, 23 Apr 2022 16:38:01 -0700
+Subject: [PATCH] [quartz] Destroy local copy of snapshot after attaching it.
+
+Because cairo_surface_snapshot_attach refs the snapshot.
+
+Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/562
+---
+ src/cairo-quartz-surface.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
+index 5681918c4..fa6d9b1c9 100644
+--- a/src/cairo-quartz-surface.c
++++ b/src/cairo-quartz-surface.c
+@@ -2609,6 +2609,7 @@ _cairo_quartz_surface_snapshot_get_image (cairo_quartz_surface_t *surface)
+       if (unlikely (!snapshot || cairo_surface_status (snapshot)))
+           return NULL;
+       _cairo_surface_attach_snapshot (&surface->base, snapshot, NULL);
++      cairo_surface_destroy (snapshot);
+     }
+ 
+     return CGImageRetain (((cairo_quartz_snapshot_t*)snapshot)->image);
+-- 
+2.32.0 (Apple Git-132)
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]