From e3aa3aac033df459debee3746feb437a506bc0f3 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 7 Sep 2016 20:32:11 -0700 Subject: Fix poorly chosen :postinit order. * struct.c (call_postinitfun_chain): call base handlers before derived ones, except in backward compatibility mode. * txr.1: Updated documentation of :postinit, and added compatibility note. --- struct.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'struct.c') diff --git a/struct.c b/struct.c index 77e57c2e..7e022ed9 100644 --- a/struct.c +++ b/struct.c @@ -366,10 +366,14 @@ static void call_initfun_chain(struct struct_type *st, val strct) static void call_postinitfun_chain(struct struct_type *st, val strct) { if (st) { - if (st->postinitfun) + int derived_first = (opt_compat && opt_compat <= 148); + + if (derived_first && st->postinitfun) funcall1(st->postinitfun, strct); if (st->super) call_postinitfun_chain(st->super_handle, strct); + if (!derived_first && st->postinitfun) + funcall1(st->postinitfun, strct); } } -- cgit v1.2.3