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] Possible regression with @EntityId on IntBag #574

Open
DaanVanYperen opened this issue May 16, 2019 · 7 comments
Open

[Bug] Possible regression with @EntityId on IntBag #574

DaanVanYperen opened this issue May 16, 2019 · 7 comments
Labels
Milestone

Comments

@DaanVanYperen
Copy link
Collaborator

DaanVanYperen commented May 16, 2019

@junkdog Another one after running the debugger ;)

Observed @EntityId with CHECK_SOURCE_AND_TARGETS cleans up deleted entities from ints and IntBags, but only on EntityLinkManager proces.
Expected @EntityId with CHECK_SOURCE_AND_TARGETS cleans up deleted entities, each time a system finishes processing.

Is this a regression or is it intended? What use is CHECK_SOURCE?

Tests for reproducing the above:
https://gist.github.com/DaanVanYperen/507888e83d9b1ff9d35810f671595360

@junkdog
Copy link
Owner

junkdog commented May 17, 2019

I'll take a closer look tomorrow, but I think it's intentional. IIrc - only clean-up/callback when entity has been purged by the EntityManager, otherwise entities may be evicted prematurely (ie; "some" time before EntiySubcriptions have fired)

@DaanVanYperen
Copy link
Collaborator Author

DaanVanYperen commented May 17, 2019

Purges are after each system invocation right? System1->purge->System2->etc.

Maybe I'm doing something wrong. As it is now, when I delete a referenced entity in System1, the @EntityId annotated reference continues to dangle throughout System2..SystemN until the EntityLinkManager is invoked and it is finally cleared.

@junkdog
Copy link
Owner

junkdog commented May 17, 2019

Ah, sorry, purge as the final step in world.process() - ComponentManager and EntityManager purging/resetting:

	public void process() {
		invocationStrategy.process();

		IntBag pendingPurge = batchProcessor.getPendingPurge();
		if (!pendingPurge.isEmpty()) {
			cm.clean(pendingPurge);
			em.clean(pendingPurge);

			batchProcessor.purgeComponents();
		}
	}

@junkdog
Copy link
Owner

junkdog commented May 17, 2019

Ouch. Yeah, sounds like a bug with impl.

@DaanVanYperen
Copy link
Collaborator Author

Maybe @LinkPolicy javadoc can be clarified a bit as well. Especially how each option interacts with @EntityId.

@junkdog
Copy link
Owner

junkdog commented May 17, 2019

Yeah, I need to brush up on the inner workings as well... (a testament for the need for good documentation!)

@DaanVanYperen DaanVanYperen changed the title [Question] How is @EntityId supposed to work on IntBags? [Bug] Possible regression with @EntityId on IntBag May 22, 2019
@DaanVanYperen DaanVanYperen added this to the artemis-2.4.0 milestone Oct 13, 2019
@DaanVanYperen
Copy link
Collaborator Author

Delaying this one release for when we have more breaking changes (gdx 1.10 etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants