Skip to content

Commit

Permalink
Fix reference-counting in set_event_filter
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
cjwatson committed Mar 28, 2024
1 parent 3a84fb7 commit db0fc61
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Core/Events.xs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ void
events_set_event_filter(callback)
SV* callback
CODE:
eventfiltersv = callback;
SvREFCNT_dec(eventfiltersv);
eventfiltersv = SvREFCNT_inc(callback);
SDL_SetEventFilter((SDL_EventFilter) eventfilter_cb);

AV *
Expand Down

0 comments on commit db0fc61

Please sign in to comment.