Skip to content
This repository was archived by the owner on Apr 17, 2020. It is now read-only.
This repository was archived by the owner on Apr 17, 2020. It is now read-only.

Patch: Irssi::signal_remove to allow removal of handlers created with coderef callbacks #798

@irssibot

Description

@irssibot

Currently, Irssi::signal_add(_*) accepts either a coderef or a string as a
callback argument.

Irssi::signal_remove does not allow the removal of handlers installed using
a coderef, since the removal code relies on the

sv_func_cmp(f1, f2) macro, which tests for pointer equivalence, and then
string equivalence.

Coderefs to the same function may (are) stored in different SV* variables,
so the pointer check is insufficient.

The attached patch checks if the function arguments are references, and if so,
checks their reference value for equality. This appears to fix the bug.

Also attached is a simple test script showing the difference between
handling string and coderef removals.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions