Skip to content

Commit

Permalink
Properly dispose of instance capture data, fixes #14795
Browse files Browse the repository at this point in the history
  • Loading branch information
reduz committed Jan 6, 2018
1 parent 59f92e4 commit bfeaf27
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions drivers/gles3/rasterizer_storage_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion servers/visual/visual_server_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit bfeaf27

Please sign in to comment.