Pārlūkot izejas kodu

Fix crash in GLES3 renderer on release builds

Make sure the `first_directional_light` RID is properly invalidated when
freed.
JFonS 4 gadi atpakaļ
vecāks
revīzija
8eb03064d1
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 5 0
      drivers/gles3/rasterizer_scene_gles3.cpp

+ 5 - 0
drivers/gles3/rasterizer_scene_gles3.cpp

@@ -4961,6 +4961,11 @@ bool RasterizerSceneGLES3::free(RID p_rid) {
 
 		LightInstance *light_instance = light_instance_owner.getptr(p_rid);
 
+		// Make sure first_directional_light is invalidated
+		if (p_rid == first_directional_light) {
+			first_directional_light = RID();
+		}
+
 		//remove from shadow atlases..
 		for (Set<RID>::Element *E = light_instance->shadow_atlases.front(); E; E = E->next()) {
 			ShadowAtlas *shadow_atlas = shadow_atlas_owner.get(E->get());