1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Properly dispose of instance capture data, fixes #14795

This commit is contained in:
Juan Linietsky
2018-01-06 19:05:34 -03:00
parent 59f92e46b9
commit bfeaf27a3e
2 changed files with 3 additions and 1 deletions

View File

@@ -6906,6 +6906,7 @@ bool RasterizerStorageGLES3::free(RID p_rid) {
// delete the texture // delete the texture
GIProbe *gi_probe = gi_probe_owner.get(p_rid); GIProbe *gi_probe = gi_probe_owner.get(p_rid);
gi_probe->instance_remove_deps();
gi_probe_owner.free(p_rid); gi_probe_owner.free(p_rid);
memdelete(gi_probe); memdelete(gi_probe);
@@ -6921,6 +6922,7 @@ bool RasterizerStorageGLES3::free(RID p_rid) {
// delete the texture // delete the texture
LightmapCapture *lightmap_capture = lightmap_capture_data_owner.get(p_rid); LightmapCapture *lightmap_capture = lightmap_capture_data_owner.get(p_rid);
lightmap_capture->instance_remove_deps();
gi_probe_owner.free(p_rid); gi_probe_owner.free(p_rid);
memdelete(lightmap_capture); memdelete(lightmap_capture);

View File

@@ -659,7 +659,6 @@ void VisualServerScene::instance_set_use_lightmap(RID p_instance, RID p_lightmap
Instance *instance = instance_owner.get(p_instance); Instance *instance = instance_owner.get(p_instance);
ERR_FAIL_COND(!instance); ERR_FAIL_COND(!instance);
ERR_FAIL_COND(!is_geometry_instance(instance->base_type));
if (instance->lightmap_capture) { if (instance->lightmap_capture) {
InstanceLightmapCaptureData *lightmap_capture = static_cast<InstanceLightmapCaptureData *>(((Instance *)instance->lightmap_capture)->base_data); 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 *instance = instance_owner.get(p_rid);
instance_set_use_lightmap(p_rid, RID(), RID());
instance_set_scenario(p_rid, RID()); instance_set_scenario(p_rid, RID());
instance_set_base(p_rid, RID()); instance_set_base(p_rid, RID());
instance_geometry_set_material_override(p_rid, RID()); instance_geometry_set_material_override(p_rid, RID());