diff --git a/include/xo/reflect/Reflect.hpp b/include/xo/reflect/Reflect.hpp index d4cfd34c..f75c3e44 100644 --- a/include/xo/reflect/Reflect.hpp +++ b/include/xo/reflect/Reflect.hpp @@ -182,11 +182,9 @@ namespace xo { } else { /* control comes here the first time require() runs */ - static detail::InvokerAux s_final_invoker; - auto final_tdx = EstablishTdx::make(); - retval_td->assign_tdextra(&s_final_invoker, + retval_td->assign_tdextra(Reflect::get_final_invoker(), std::move(final_tdx)); /* also need to require for each child */ @@ -222,7 +220,8 @@ namespace xo { auto final_tdx = EstablishFunctionTdx::make(); - retval_td->assign_tdextra(std::move(final_tdx)); + retval_td->assign_tdextra(Reflect::get_final_invoker(), + std::move(final_tdx)); /* also need to require for each child */ } @@ -254,6 +253,16 @@ namespace xo { template static TaggedRcptr make_rctp(T * x) { return TaggedPtrMaker::make_rctp(x); } + + private: + + template + static detail::InvokerAux * get_final_invoker() { + static detail::InvokerAux s_final_invoker; + + return &s_final_invoker; + } + }; /*Reflect*/ // ----- MakeTagged -----