Properly dispose of instance capture data, fixes #14795
This commit is contained in:
parent
59f92e46b9
commit
bfeaf27a3e
|
@ -6906,6 +6906,7 @@ bool RasterizerStorageGLES3::free(RID p_rid) {
|
|||
|
||||
// delete the texture
|
||||
GIProbe *gi_probe = gi_probe_owner.get(p_rid);
|
||||
gi_probe->instance_remove_deps();
|
||||
|
||||
gi_probe_owner.free(p_rid);
|
||||
memdelete(gi_probe);
|
||||
|
@ -6921,6 +6922,7 @@ bool RasterizerStorageGLES3::free(RID p_rid) {
|
|||
|
||||
// delete the texture
|
||||
LightmapCapture *lightmap_capture = lightmap_capture_data_owner.get(p_rid);
|
||||
lightmap_capture->instance_remove_deps();
|
||||
|
||||
gi_probe_owner.free(p_rid);
|
||||
memdelete(lightmap_capture);
|
||||
|
|
|
@ -659,7 +659,6 @@ void VisualServerScene::instance_set_use_lightmap(RID p_instance, RID p_lightmap
|
|||
|
||||
Instance *instance = instance_owner.get(p_instance);
|
||||
ERR_FAIL_COND(!instance);
|
||||
ERR_FAIL_COND(!is_geometry_instance(instance->base_type));
|
||||
|
||||
if (instance->lightmap_capture) {
|
||||
InstanceLightmapCaptureData *lightmap_capture = static_cast<InstanceLightmapCaptureData *>(((Instance *)instance->lightmap_capture)->base_data);
|
||||
|
@ -3298,6 +3297,7 @@ bool VisualServerScene::free(RID p_rid) {
|
|||
|
||||
Instance *instance = instance_owner.get(p_rid);
|
||||
|
||||
instance_set_use_lightmap(p_rid, RID(), RID());
|
||||
instance_set_scenario(p_rid, RID());
|
||||
instance_set_base(p_rid, RID());
|
||||
instance_geometry_set_material_override(p_rid, RID());
|
||||
|
|
Loading…
Reference in New Issue