~ruther/guix-local

94a9b26bcfa5446ca1e98968ae47a8cc74a158dc — Vivien Kraus 2 years ago 4ebc426
gnu: cogl: Fix double free.

This patch fixes a double free in cogl, which broke all of the test cases and
thus also the package build itself.

* gnu/packages/patches/cogl-fix-double-free.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/gnome.scm (cogl): Use it here.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
3 files changed, 36 insertions(+), 1 deletions(-)

M gnu/local.mk
M gnu/packages/gnome.scm
A gnu/packages/patches/cogl-fix-double-free.patch
M gnu/local.mk => gnu/local.mk +1 -0
@@ 1025,6 1025,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/clucene-pkgconfig.patch			\
  %D%/packages/patches/cmake-curl-certificates-3.24.patch	\
  %D%/packages/patches/coda-use-system-libs.patch		\
  %D%/packages/patches/cogl-fix-double-free.patch		\
  %D%/packages/patches/collectd-5.11.0-noinstallvar.patch		\
  %D%/packages/patches/combinatorial-blas-awpm.patch		\
  %D%/packages/patches/combinatorial-blas-io-fix.patch		\

M gnu/packages/gnome.scm => gnu/packages/gnome.scm +3 -1
@@ 6133,7 6133,9 @@ throughout GNOME for API documentation).")
                           (version-major+minor version) "/"
                           "cogl-" version ".tar.xz"))
       (sha256
        (base32 "0nfph4ai60ncdx7hy6hl1i1cmp761jgnyjfhagzi0iqq36qb41d8"))))
        (base32 "0nfph4ai60ncdx7hy6hl1i1cmp761jgnyjfhagzi0iqq36qb41d8"))
       (patches
        (search-patches "cogl-fix-double-free.patch"))))
    ;; NOTE: mutter exports a bundled fork of cogl, so when making changes to
    ;; cogl, corresponding changes may be appropriate in mutter as well.
    (build-system gnu-build-system)

A gnu/packages/patches/cogl-fix-double-free.patch => gnu/packages/patches/cogl-fix-double-free.patch +32 -0
@@ 0,0 1,32 @@
From 15d0f7d96cf53263196e26f2eb48ededdff0efeb Mon Sep 17 00:00:00 2001
Message-ID: <15d0f7d96cf53263196e26f2eb48ededdff0efeb.1694148833.git.vivien@planete-kraus.eu>
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Thu, 7 Sep 2023 22:16:48 +0200
Subject: [PATCH] Prevent double free on context objects

The display is unrefed in the context destructor, but not refed in the
constructor.

This targets an archived (read-only) repository.
---
 cogl/cogl-context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index a7eed29a..7cdc9fe7 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -218,7 +218,7 @@ cogl_context_new (CoglDisplay *display,
       return NULL;
     }
 
-  context->display = display;
+  context->display = cogl_object_ref (display);
 
   /* This is duplicated data, but it's much more convenient to have
      the driver attached to the context and the value is accessed a

base-commit: 61d966c7442d521e38572b7f93ac7b8973a9c65e
-- 
2.41.0