Skip to content

fix(sirens): track active rotators per vehicle instance to prevent dangling pointer crashes - #354

Open
CanerKaraca23 wants to merge 1 commit into
user-grinch:mainfrom
CanerKaraca23:fix/sirens-instance-rotators
Open

CanerKaraca23 wants to merge 1 commit into
user-grinch:mainfrom
CanerKaraca23:fix/sirens-instance-rotators

Conversation

@CanerKaraca23

Copy link
Copy Markdown
Collaborator

Summary

Fixes a dangling pointer crash in the sirens system when multiple instances of the same emergency vehicle model exist simultaneously or when an instance is despawned.

Details

  • Previously, Sirens::modelRotators stored active rotator dummy pointers in a static model-indexed map (std::map<int, std::vector<VehicleDummy *>> modelRotators).
  • When multiple vehicles shared the same model index or a vehicle instance was deleted while another was running, rotator dummy pointers in modelRotators would be overwritten or refer to freed vehicle memory, causing access violation crashes during ResetAngle().
  • Moves ActiveRotators tracking into per-vehicle extended data (VehicleSirensData::ActiveRotators), guaranteeing safe per-instance lifecycle management without cross-vehicle interference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant