Fix Cycles rendering crash on OpenBSD

Static initialization order was not guaranteed to be correct for node base
types. Now wrap all initialization in accessor functions to ensure the order
is correct.

Did not cause any known bug on Linux/macOS/Windows, but showed up on this
platform.
This commit is contained in:
Brecht Van Lommel
2021-03-15 16:11:12 +01:00
parent 3fdef12162
commit cd3fade2aa
17 changed files with 141 additions and 130 deletions

View File

@@ -82,7 +82,7 @@ NODE_DEFINE(Object)
{
NodeType *type = NodeType::add("object", create);
SOCKET_NODE(geometry, "Geometry", &Geometry::node_base_type);
SOCKET_NODE(geometry, "Geometry", Geometry::get_node_base_type());
SOCKET_TRANSFORM(tfm, "Transform", transform_identity());
SOCKET_UINT(visibility, "Visibility", ~0);
SOCKET_COLOR(color, "Color", zero_float3());
@@ -98,13 +98,13 @@ NODE_DEFINE(Object)
SOCKET_BOOLEAN(is_shadow_catcher, "Shadow Catcher", false);
SOCKET_NODE(particle_system, "Particle System", &ParticleSystem::node_type);
SOCKET_NODE(particle_system, "Particle System", ParticleSystem::get_node_type());
SOCKET_INT(particle_index, "Particle Index", 0);
return type;
}
Object::Object() : Node(node_type)
Object::Object() : Node(get_node_type())
{
particle_system = NULL;
particle_index = 0;