fixes for the fact that Spicy event handlers start off with a null type

This commit is contained in:
Vern Paxson 2025-09-26 09:56:05 -07:00
parent bd7784b848
commit 08ead8952e

View file

@ -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>(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;
}