Fix memory leaks in RasterizerStorageDummy::free
Lightmap capture data is now freed as well free() now also properly returns true or false based on if something was actually freed.
This commit is contained in:
parent
087a83fd54
commit
23d44223e6
|
@ -725,20 +725,25 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool free(RID p_rid) {
|
bool free(RID p_rid) {
|
||||||
|
|
||||||
if (texture_owner.owns(p_rid)) {
|
if (texture_owner.owns(p_rid)) {
|
||||||
// delete the texture
|
// delete the texture
|
||||||
DummyTexture *texture = texture_owner.get(p_rid);
|
DummyTexture *texture = texture_owner.get(p_rid);
|
||||||
texture_owner.free(p_rid);
|
texture_owner.free(p_rid);
|
||||||
memdelete(texture);
|
memdelete(texture);
|
||||||
}
|
} else if (mesh_owner.owns(p_rid)) {
|
||||||
|
|
||||||
if (mesh_owner.owns(p_rid)) {
|
|
||||||
// delete the mesh
|
// delete the mesh
|
||||||
DummyMesh *mesh = mesh_owner.getornull(p_rid);
|
DummyMesh *mesh = mesh_owner.getornull(p_rid);
|
||||||
mesh_owner.free(p_rid);
|
mesh_owner.free(p_rid);
|
||||||
memdelete(mesh);
|
memdelete(mesh);
|
||||||
|
} else if (lightmap_capture_data_owner.owns(p_rid)) {
|
||||||
|
// delete the lightmap
|
||||||
|
LightmapCapture *lightmap_capture = lightmap_capture_data_owner.getornull(p_rid);
|
||||||
|
lightmap_capture_data_owner.free(p_rid);
|
||||||
|
memdelete(lightmap_capture);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue