Skip to content

Commit fbf151a

Browse files
committed
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)
1 parent 3a84fb7 commit fbf151a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Core/Events.xs

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ void
102102
events_set_event_filter(callback)
103103
SV* callback
104104
CODE:
105-
eventfiltersv = callback;
105+
SvREFCNT_dec(eventfiltersv);
106+
eventfiltersv = SvREFCNT_inc_simple(callback);
106107
SDL_SetEventFilter((SDL_EventFilter) eventfilter_cb);
107108

108109
AV *

0 commit comments

Comments
 (0)