Sign in to follow this  

Stale Component Reference (boatwidget)


DarkXero
  • Version: PC/MAC/Linux Fixed

Rebuilding the inventory bar (example, equipping a backpack) after exiting a boat prints a Stale Component Reference.

Because OpenBoat of screens/playerhud does

self.controls.inv.boatwidget = self.controls.inv.root:AddChild(ContainerWidget(self.owner))

which is then closed when exiting a boat, but not detached from inventorybar class.

So, when doing this in Rebuild of widgets/inventorybar

if self.boatwidget then
	self.boatwidget:SetPosition(Vector3(700, do_integrated_backpack and 105 or 65, 0))
end

the widget isn't actually valid, but the reference exists, and so, SetPosition is called.

 

Putting

	if self.boatwidget then
		if self.boatwidget.inst:IsValid() then
			self.boatwidget:SetPosition(Vector3(700, do_integrated_backpack and 105 or 65, 0))
		else
			self.boatwidget = nil
		end
	end

stops the error and cleans the reference.

 

The clean way would be to make a CloseBoat method in the HUD and plug it into the Close of the container component, like how Open from container works with OpenBoat.


Steps to Reproduce
1) Spawn a row boat 2) Enter it 3) Exit it 4) Spawn backpack 5) Equip backpack 6) Check log

Status: Fixed

This issue has been fixed in either a future version or updated in a previous version.


  • Like 1
  Report Bug
Sign in to follow this  


User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.
....


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now