Skip to content

Fix segfault when shields are removed after thinking

Hanicef requested to merge Hanicef/SRB2:fix-removed-shield-segfault into next

For shields, there's a segfault that can trigger if a player's shield is removed using P_RemoveMobj after it's thinking logic has been invoked. This is caused by the thinking logic calling P_AddShield to add the shield for processing later when P_RunShields is invoked. The problem is that P_RemoveMobj doesn't actually remove the shield from the list of shields to be processed by P_RunShields, so if it's removed after it has been added to shields to be processed, it will attempt to process the removed shield once P_RunShields is invoked and segfault.

Merge request reports

Loading