Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add guards to verify that the unit instance still exists #6342

Merged
merged 2 commits into from
Jul 12, 2024

Conversation

Garanas
Copy link
Member

@Garanas Garanas commented Jul 12, 2024

Description of the proposed changes

Fixes a rather invisible bug from #6263 .

The logging when the pcall fails is disabled at the moment. Luckily, the errors are caught and registered by the c-debugger. The tables with unit references in them are cleaned up automagically by the garbage collector, but there can be a few ticks in between the unit dying and the unit being collected. In those few ticks it can generate various errors.

@c:\programdata\faforever\replaydata\gamedata\lua.nx2\lua\aibrains\components\storagemanagerbraincomponent.lua 179
CObject:.?AVCAiBrain@Moho@@, CFunc, "EconMidMassStore", "EconMidEnergyStore"
@c:\programdata\faforever\replaydata\gamedata\lua.nx2\lua\aibrains\components\storagemanagerbraincomponent.lua 187
CObject:.?AVCAiBrain@Moho@@, "EconMidEnergyStore", CFunc, Table, "8388651", Table, Func:@c:\programdata\faforever\replaydata\gamedata\lua.nx2\lua\sim\units\factoryunit.lua 510
@c:\programdata\faforever\replaydata\gamedata\lua.nx2\lua\aibrains\components\storagemanagerbraincomponent.lua 169
@CFunc: 0x0090F5B0
Table, "EconMidEnergyStore"
@c:\programdata\faforever\replaydata\gamedata\lua.nx2\lua\sim\units\factoryunit.lua 514
Table, "Green", "Red", CObject:.?AVCAiBrain@Moho@@
@c:\programdata\faforever\replaydata\gamedata\lua.nx2\lua\sim\units\components\blinkinglightsunitcomponent.lua 56
Table, UData:1B2F8F88, "...sim\units\components\blinkinglightsunitcomponent.lua(56): Game object has been destroyed
stack traceback:
	[C]: in function `GetNumBuildOrders'
	...sim\units\components\blinkinglightsunitcomponent.lua(56): in function `ChangeBlinkingLights'
	...ydata\gamedata\lua.nx2\lua\sim\units\factoryunit.lua(514): in function <...ydata\gamedata\lua.nx2\lua\sim\units\factoryunit.lua:510>
	[C]: in function `pcall'
	...aibrains\components\storagemanagerbraincomponent.lua(169): in function `ApplyEnergyStorageState'
	...aibrains\components\storagemanagerbraincomponent.lua(187): in function <...aibrains\components\storagemanagerbraincomponent.lua:179>"

Checklist

  • Changes are annotated, including comments where useful
  • Changes are documented in the changelog for the next game version

@Garanas Garanas merged commit cc6c3bf into develop Jul 12, 2024
5 checks passed
@Garanas Garanas deleted the Fix/blinking-lights-guards branch July 12, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant