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

[Bug] EntityService dispose() doesn't work #10

Open
ThatTechedGuy opened this issue Sep 20, 2021 · 2 comments
Open

[Bug] EntityService dispose() doesn't work #10

ThatTechedGuy opened this issue Sep 20, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@ThatTechedGuy
Copy link

ThatTechedGuy commented Sep 20, 2021

Duplicate from: UQdeco2800/2021-ext-studio-2#271

Description

Entity components for a particular Screen are registered to the EntityService. When the EntityService initialized for that particular screen is disposed, the dispose() functions for each component attached to that Entity are not called. Manually calling entity.dispose() works, but ServiceLocator.getEntityService.dispose() does not work.

How to reproduce

The dispose() function of the SettingsMenuDisplay component does not get called when ServiceLocator.getEntityService().dispose() is called on the SettingsScreen, although the corresponding entity is registered to the service as we can see in the createUI() method. Disposing the entity manually in SettingsScreen's dispose() function works.

Temporary Fix

Dispose the entity manually in SettingsScreens dispose() function.

Suggestions: Most probably, the problem is in Entity.java or EntityService.java but I am not sure.

@ThatTechedGuy ThatTechedGuy changed the title EntityService disposals dont work [Bug] EntityService dispose() doesn't work Sep 20, 2021
@applebyter applebyter added the bug Something isn't working label Sep 21, 2021
@lisslulay
Copy link

Duplicate from: UQdeco2800/2021-ext-studio-2#271 (comment)
In EntityService.java, we can see that when dispose() is called, two entities exist. But SettingsMenuDisplay is not traversed.
image
I don't know why this phenomenon occurs, below is the code to traverse the entities.
image
This situation exists in other screens, even in the original game engine.
image
I didn't figure out why this phenomenon happened, dispose() in EntityService seems to only do part of the work. Maybe there are other reasons for this.
What I can confirm is that the dispose of CameraConponent does not eliminate SettingsMenuDisplay entity.
image
And SettingsMenuDisplay has never called the dispose method in the eneity.java file.

@ThatTechedGuy
Copy link
Author

Right, @lisslulay the component is created but not disposed. Nasty bug! xD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants