Fix free(RID) abuse by various classes

This commit is contained in:
Cory Petkovsek 2022-08-11 02:22:37 +08:00
parent 850c5ccccf
commit f7f112ab1f
3 changed files with 12 additions and 4 deletions

View File

@ -419,5 +419,7 @@ Particles2D::Particles2D() {
} }
Particles2D::~Particles2D() { Particles2D::~Particles2D() {
VS::get_singleton()->free(particles); if (particles.is_valid()) {
VS::get_singleton()->free(particles);
}
} }

View File

@ -179,7 +179,9 @@ GIProbeData::GIProbeData() {
} }
GIProbeData::~GIProbeData() { GIProbeData::~GIProbeData() {
VS::get_singleton()->free(probe); if (probe.is_valid()) {
VS::get_singleton()->free(probe);
}
} }
////////////////////// //////////////////////
@ -527,5 +529,7 @@ GIProbe::GIProbe() {
} }
GIProbe::~GIProbe() { GIProbe::~GIProbe() {
VS::get_singleton()->free(gi_probe); if (gi_probe.is_valid()) {
VS::get_singleton()->free(gi_probe);
}
} }

View File

@ -416,5 +416,7 @@ Particles::Particles() {
} }
Particles::~Particles() { Particles::~Particles() {
VS::get_singleton()->free(particles); if (particles.is_valid()) {
VS::get_singleton()->free(particles);
}
} }