Irssi core bugs

Notice: Undefined index: tasklist_type in /var/www/ : eval()'d code on line 85 Notice: Undefined index: tasklist_type in /var/www/ : eval()'d code on line 90
  • Status Unconfirmed
  • Percent Complete
  • Task Type Bug Report
  • Category core
  • Assigned To No-one
  • Operating System Linux
  • Severity Medium
  • Priority Normal
  • Reported Version irssi 0.8.15
  • Due in Version Undecided
  • Due Date Undecided
  • Votes 0
  • Private No
Attached to Project: Irssi core bugs
Opened by Tom (shabble) - 2011-04-08

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

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.

This task does not depend on any other tasks.

Tom (shabble)
Friday, 08 April 2011, 19:44 GMT

It is possible to remove coderef callbacks as long as you ensure that the same variable is actually used in both cases.

eg: my $ref = \&foo;

signal_add('blah', $ref);
signal_remove('blah', $ref);

In this case, the pointer equality test does work. Still not really practical though.