bugfix(particlesys): Delay particle system destruction to prevent orphaning slaved finite-lifetime particle systems - #3238
Conversation
PR Summary by QodoPrevent master particle systems outliving linked slave cleanup
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. Forever slave retains master
|
| // check if time is up | ||
| if (m_systemLifetimeLeft == 0) | ||
| return false; | ||
| m_isDestroyed = true; |
There was a problem hiding this comment.
1. Forever slave retains master 🐞 Bug ☼ Reliability
Natural lifetime expiry now sets only the master's m_isDestroyed, even though destroy() is the path that propagates destruction to its slave. A linked slave with the supported default SystemLifetime of zero is forever-lived, so it never clears the link and the master's new wait guard returns true indefinitely, leaking and updating both systems for the rest of the session.
Agent Prompt
## Issue description
Natural lifetime expiry marks only the master particle system as destroyed. If its slave has the supported default zero system lifetime, the slave never destroys itself, so the master waits on the slave forever and both systems remain registered and updated.
## Issue Context
`ParticleSystem::destroy()` already marks the current system destroyed and propagates destruction to its slave. A zero `SystemLifetime` is initialized by default and is interpreted as `m_isForever = true`, while the newly added master guard refuses deletion until the slave clears the relationship.
## Fix Focus Areas
- Core/GameEngine/Source/GameClient/System/ParticleSys.cpp[1320-1328]
- Core/GameEngine/Source/GameClient/System/ParticleSys.cpp[2139-2153]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
fixed by checking for forever-lived particles and acting like before the change.
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/GameClient/System/ParticleSys.cpp | Adds finite-slave retention, but the forever-slave exemption still deletes the master while merely detaching and retaining the slave. |
Reviews (5): Last reviewed commit: "fix(particlesys): Prevent master particl..." | Re-trigger Greptile
18a5e53 to
7a25825
Compare
|
Fixed the initial lifetime issue of forever particle systems brought up by the bots. |
7a25825 to
bba9374
Compare
bba9374 to
bfca22f
Compare
|
Tweaked from recent feedback, should be good now. |
…es before their slave system (#)
bfca22f to
43450ea
Compare
Alternative to: #3071
Closes: #3071
Closed: #2645
This PR alters the lifetime handling of linked particle systems. Preventing a master particle system destroying itself before any slaved particle systems have been destroyed.
The result of a slave system losing its master are the following:
m_isDestroyedvariable gets set which cuts the systems lifetime short.The above occurs due to the random nature of particle lifetimes. And when a master particle system destroys itself,
the destructor clears the master of the slave system and calls
destroy()which sets the slave systemsm_isDestroyed.With this fix a master particle system checks if it has a finite-lifetime slaved particle system and will not destroy itself till the slaved particle system has been destroyed.
This allows the slaved particle system to fully run the course of its lifetime and render properly.
EDIT - This only applies to finite lifetime particle systems now, it has been tweaked to destroy infinite lifetime systems like it did prior to this change.