fix(contain): remove destroyed detached occupants#236
Open
mreza0100 wants to merge 1 commit into
Open
Conversation
fbraz3
requested changes
Jul 24, 2026
| object->kill(); // in case we are carrying flame proof troops we have been asked to kill | ||
|
|
||
| if ( object->isEffectivelyDead() ) | ||
| // TheSuperHackers @bugfix mreza0100 23/07/2026 A destroyed occupant cannot remove itself |
Owner
There was a problem hiding this comment.
Could you please change the comment for the GeneralsX pattern? thanks!
// GeneralsX @keyword author DD/MM/YYYY A meaningful description for this change.
Details: https://github.com/fbraz3/GeneralsX/blob/main/CONTRIBUTING.md
| object->kill(); // in case we are carrying flame proof troops we have been asked to kill | ||
|
|
||
| if ( object->isEffectivelyDead() ) | ||
| // TheSuperHackers @bugfix mreza0100 23/07/2026 A destroyed occupant cannot remove itself |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RETAIL_COMPATIBLE_CRCbehavior unchangedRoot cause
OpenContain::processDamageToContainedtemporarily swapsm_containListout to avoid iterator invalidation. A nesteddestroyObjectcall cannot deregister a rider while that list is detached. If the rider is marked destroyed without becoming effectively dead, the old code restores it; deferred deletion then leaves a dangling pointer. A later container eviction can callTransportContain::onRemovingon the destructed object and crash inObject::onDisabledEdgebecausem_behaviorsis null.The fix excludes both effectively-dead and explicitly destroyed occupants before restoring the detached list. The normal live-occupant path is unchanged.
Validation
z_generalsbuilds successfullyg_generalsbuilds successfullygit diff --checkpassesAI assistance
The crash report and engine lifecycle were analyzed with AI assistance. The final logic change was manually scoped to the identified list-detachment invariant and verified against both game variants and full native builds.