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

EntityPrototypeView has become disposable #5466

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Robust.Client/UserInterface/Controls/EntityPrototypeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,15 @@ protected override void ExitedTree()
base.ExitedTree();
EntMan.TryQueueDeleteEntity(_ourEntity);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);

if (!disposing)
return;

if (_ourEntity is not null)
EntMan.DeleteEntity(_ourEntity);
}
Comment on lines +59 to +69
Copy link
Contributor

@metalgearsloth metalgearsloth Sep 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ExitedTree handles this, it seems like you're having an issue elsewhere.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ExitedTree handles this, it seems like you're having an issue elsewhere.

Before adding explicit entity deletion in the Dispose method, DeleteAllThenGhost test was crashing with 100% chance. In debug mode, breakpoints and call stack I realized that the problem is in EntityPrototypeView, it generates undeletable entities. For some reason ExitedTree method does not work. As I wrote in Discord, after adding Dispose, the test started to pass.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like ExitedTree is not being called when it should be then?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like ExitedTree is not being called when it should be then?

It looks like, but Dispose is enough for my PR to work

}
Loading