Fix leaking environment RIDs in GLES2

This PR adds the code necessary to correctly free environments in GLES2, which was previously missing causing them to leak.
This commit is contained in:
lawnjelly 2021-12-07 18:42:10 +00:00
parent 98e0ebfc4b
commit 7134ef90bb

View file

@ -3875,6 +3875,7 @@ bool RasterizerSceneGLES2::free(RID p_rid) {
shadow_atlas_set_size(p_rid, 0);
shadow_atlas_owner.free(p_rid);
memdelete(shadow_atlas);
} else if (reflection_probe_instance_owner.owns(p_rid)) {
ReflectionProbeInstance *reflection_instance = reflection_probe_instance_owner.get(p_rid);
@ -3892,6 +3893,12 @@ bool RasterizerSceneGLES2::free(RID p_rid) {
reflection_probe_instance_owner.free(p_rid);
memdelete(reflection_instance);
} else if (environment_owner.owns(p_rid)) {
Environment *environment = environment_owner.get(p_rid);
environment_owner.free(p_rid);
memdelete(environment);
} else {
return false;
}