From 08ead8952e95c61d28bace0beff0a7773f8058d7 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Fri, 26 Sep 2025 09:56:05 -0700 Subject: [PATCH] fixes for the fact that Spicy event handlers start off with a null type --- src/script_opt/CPP/RuntimeInitSupport.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/script_opt/CPP/RuntimeInitSupport.cc b/src/script_opt/CPP/RuntimeInitSupport.cc index 2ae4b9c2fd..3c5c1b06c6 100644 --- a/src/script_opt/CPP/RuntimeInitSupport.cc +++ b/src/script_opt/CPP/RuntimeInitSupport.cc @@ -110,6 +110,12 @@ void activate_bodies__CPP(const char* fn, const char* module, bool exported, Typ fg->SetType(ft); } + if ( ! fg->GetType() ) + // This can happen both because we just installed the ID, but also + // because events registered by Spicy don't have types associated + // with them initially. + fg->SetType(ft); + if ( ! fg->GetAttr(ATTR_IS_USED) ) fg->AddAttr(make_intrusive(ATTR_IS_USED)); @@ -175,6 +181,9 @@ IDPtr lookup_global__CPP(const char* g, const TypePtr& t, const GlobalCharacteri gl->MakeType(); } + else if ( ! gl->GetType() ) + gl->SetType(t); + return gl; }