From 93fb77c98e002f21858fe9efa1bf6a8ce2144178 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 7 Jul 2011 00:32:38 -0500 Subject: oops, need a new ref to the cv for each op --- smartmatch.xs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'smartmatch.xs') diff --git a/smartmatch.xs b/smartmatch.xs index b3e12c5..28cf0e0 100644 --- a/smartmatch.xs +++ b/smartmatch.xs @@ -17,7 +17,7 @@ smartmatch_cb(pTHX_ OP *o, void *user_data) o->op_flags &= ~OPf_KIDS; op_free(o); - cb_op = newSVOP(OP_CONST, 0, (SV*)user_data); + cb_op = newSVOP(OP_CONST, 0, newSVsv(user_data)); list = newLISTOP(OP_LIST, 0, left, right); new = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, list, cb_op)); @@ -56,5 +56,10 @@ register (cb) void unregister (id) UV id; + PREINIT: + SV *cb; CODE: - hook_op_check_smartmatch_remove(id); + cb = hook_op_check_smartmatch_remove(id); + if (cb) { + SvREFCNT_dec(cb); + } -- cgit v1.2.3-54-g00ecf