- if (n->types & NOTIFY_IS_DESTRUCTOR)
- n->u.destroy(from_tal_hdr(ctx));
- else
- n->u.notifyfn(from_tal_hdr(ctx), type,
+ errno = saved_errno;
+ if (n->types & NOTIFY_IS_DESTRUCTOR) {
+ /* Blatt this notifier in case it tries to
+ * tal_del_destructor() from inside */
+ union notifier_cb cb = n->u;
+ /* It's a union, so this NULLs destroy2 too! */
+ n->u.destroy = NULL;
+ if (n->types & NOTIFY_EXTRA_ARG)
+ cb.destroy2(from_tal_hdr(ctx),
+ EXTRA_ARG(n));
+ else
+ cb.destroy(from_tal_hdr(ctx));
+ } else
+ n->u.notifyfn(from_tal_hdr_or_null(ctx), type,