Page MenuHomeFeedback Tracker

Problem with using destructors (and constructors) in vanilla code
New, NormalPublic

Description

	//-----------------------------------------------------------------------------------------------------------
	void ~SCR_CharacterDamageManagerComponent()
	{
		RemoveBleeding();
	}

I think this is causing the game to crash if a unit is deleted if they are bleeding.
The problem is, it cannot be overwritten, because it's in the destructor

All vanilla functions for moddable classes should use a buffer function to allow overwriting by modding.

example:

	//-----------------------------------------------------------------------------------------------------------
	void OnDestruction() {
		RemoveBleeding();

	};

	//-----------------------------------------------------------------------------------------------------------
	void ~SCR_CharacterDamageManagerComponent()
	{
		OnDestruction();
	}

Now anyone can just override the buffer function and remove crashes

Details

Severity
Tweak
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
General
Steps To Reproduce
  1. Start in workbench
  2. Start world editor live mode
  3. become game master
  4. spawn 1 unit
  5. right click -> start bleeding
  6. delete unit with game master
  7. crash
Additional Information

I don't see any downsides to opting to use buffer functions for all destructors and even constructors.
Perhaps this should be a coding guideline

Event Timeline