Fix release build crash on level load

This commit is contained in:
MrBruh committed 2026-09-27 19:56:32 +13:00
1 parent b0e3bc96e3
commit fef8a582dd
2 files changed
+18 -1

No files matched your search

+11 -1
View File
@@ -1765,10 +1765,20 @@ void object_reconnect_to_map(
}
else
{
#ifdef HALO_LINUX
/* location may point here after the if below: declared inside it,
the location would be read after its lifetime ended, which an
optimising compiler is free to break (release builds crashed placing
objects at level start, reading a stack slot reused meanwhile) */
struct location bounding_sphere_location;
#endif
if (!location)
{
#ifndef HALO_LINUX
struct location bounding_sphere_location;
#endif
scenario_location_from_point(&bounding_sphere_location, &object->object.bounding_sphere_center);
location = &bounding_sphere_location;
+7
View File
@@ -320,6 +320,11 @@ void collision_debug_render(
real_matrix4x3 const *matrix = NULL;
struct collision_surface const *surface = NULL;
char textstring[2048];
#ifdef HALO_LINUX
/* matrix points into it after the else if below, so it
has to outlive that block (see object_reconnect_to_map) */
struct collision_model_instance instance;
#endif
render_debug_vector(TRUE, &point, &vector, collision.t, global_real_argb_red);
render_debug_point(TRUE, &collision.point, 0.125f, global_real_argb_red);
@@ -331,7 +336,9 @@ void collision_debug_render(
}
else if (collision.type == _collision_result_object && collision.node_index != NONE)
{
#ifndef HALO_LINUX
struct collision_model_instance instance;
#endif
if (collision_model_instance_new(&instance, collision.object_index))
{