[Bf-blender-cvs] [2a9316d33ca] functions: actually free emitters etc.
Jacques Lucke
noreply at git.blender.org
Thu Jun 20 15:51:15 CEST 2019
Commit: 2a9316d33ca4bc4e38ef7827c8fdb3cc32b32af8
Author: Jacques Lucke
Date: Thu Jun 20 12:44:07 2019 +0200
Branches: functions
https://developer.blender.org/rB2a9316d33ca4bc4e38ef7827c8fdb3cc32b32af8
actually free emitters etc.
===================================================================
M source/blender/simulations/bparticles/c_wrapper.cpp
M source/blender/simulations/bparticles/core.cpp
M source/blender/simulations/bparticles/core.hpp
===================================================================
diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp b/source/blender/simulations/bparticles/c_wrapper.cpp
index 76137db6ff2..cc3ab14ca11 100644
--- a/source/blender/simulations/bparticles/c_wrapper.cpp
+++ b/source/blender/simulations/bparticles/c_wrapper.cpp
@@ -57,6 +57,19 @@ class ModifierStepParticleInfluences : public ParticleInfluences {
SmallVector<Event *> m_events;
SmallVector<Action *> m_actions;
+ ~ModifierStepParticleInfluences()
+ {
+ for (Force *force : m_forces) {
+ delete force;
+ }
+ for (Event *event : m_events) {
+ delete event;
+ }
+ for (Action *action : m_actions) {
+ delete action;
+ }
+ }
+
ArrayRef<Force *> forces() override
{
return m_forces;
@@ -77,6 +90,13 @@ class ModifierStepDescription : public StepDescription {
SmallVector<Emitter *> m_emitters;
ModifierStepParticleInfluences m_influences;
+ ~ModifierStepDescription()
+ {
+ for (Emitter *emitter : m_emitters) {
+ delete emitter;
+ }
+ }
+
float step_duration() override
{
return m_duration;
diff --git a/source/blender/simulations/bparticles/core.cpp b/source/blender/simulations/bparticles/core.cpp
index a88fbb98072..d4340ee0046 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -18,4 +18,17 @@ Event::~Event()
{
}
+ParticleInfluences::~ParticleInfluences()
+{
+}
+
+StepDescription::~StepDescription()
+{
+}
+
+ParticlesState::~ParticlesState()
+{
+ delete m_container;
+}
+
} // namespace BParticles
diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index 09ec3e20e5e..84a1ab99105 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -129,6 +129,8 @@ class Emitter {
class ParticleInfluences {
public:
+ virtual ~ParticleInfluences();
+
virtual ArrayRef<Force *> forces() = 0;
virtual ArrayRef<Event *> events() = 0;
virtual ArrayRef<Action *> action_per_event() = 0;
@@ -136,6 +138,8 @@ class ParticleInfluences {
class StepDescription {
public:
+ virtual ~StepDescription();
+
virtual float step_duration() = 0;
virtual ArrayRef<Emitter *> emitters() = 0;
virtual ParticleInfluences &influences() = 0;
@@ -147,6 +151,7 @@ class ParticlesState {
float m_current_time = 0.0f;
ParticlesState() = default;
+ ~ParticlesState();
};
} // namespace BParticles
More information about the Bf-blender-cvs
mailing list