File: event-filter-refcount.patch

package info (click to toggle)
libsdl-perl 2.548-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,972 kB
  • sloc: perl: 13,985; ansic: 583; makefile: 35
file content (34 lines) | stat: -rw-r--r-- 1,197 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From db0fc617585073065afb1aff3c4e6f5c42748548 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@debian.org>
Date: Thu, 28 Mar 2024 13:21:47 +0000
Subject: [PATCH] Fix reference-counting in set_event_filter

This previously resulted in the following test failure with Perl 5.38.2
on Debian unstable (https://bugs.debian.org/1064761):

    t/core_events.t ................. 1/? Can't use an undefined value as a subroutine reference during global destruction.
    t/core_events.t ................. Dubious, test returned 22 (wstat 5632, 0x1600)
    All 691 subtests passed
            (less 1 skipped subtest: 690 okay)

Bug-Debian: https://bugs.debian.org/1064761
Forwarded: https://github.com/PerlGameDev/SDL/pull/308

---
 src/Core/Events.xs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: b/src/Core/Events.xs
===================================================================
--- a/src/Core/Events.xs
+++ b/src/Core/Events.xs
@@ -102,7 +102,8 @@
 events_set_event_filter(callback)
 	SV* callback
 	CODE:
-		eventfiltersv = callback;
+		SvREFCNT_dec(eventfiltersv);
+		eventfiltersv = SvREFCNT_inc(callback);
 		SDL_SetEventFilter((SDL_EventFilter) eventfilter_cb);
 
 AV *