skypjack / entt

Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more
https://github.com/skypjack/entt/wiki
MIT License
10.24k stars 892 forks source link

crash when calling registry::create function. #1192

Closed LaurentDuroisin7601 closed 1 day ago

LaurentDuroisin7601 commented 2 days ago

I'm trying to use entt for a project but I got a crash at this place :

ParticleSystem::ParticleSystem(math::Vec3f position, math::Vec3f size, graphic::ecs::ComponentMapping& cmapping) : mParticles() , mAffectors() , mEmitters() , mNeedsVertexUpdate(true) , mQuads() , mNeedsQuadUpdate(true) , cmapping(cmapping) { entity = cmapping.getEntityFactory().createEntity("E_PARTICLES"); ... } When I call the create function of the factory

EntityId createEntity(std::string groupName="") { EntityId id = m_Registery.create(); /*nbEntities++; if (groupName != "") { updateTypes(groupName); }*/ return id; }

LaurentDuroisin7601 commented 2 days ago

0 ?? entt::basic_sparse_set<entt::entity, std::allocator >::operator[] (this=0x441fcbc, pos=1518500249) (../../ODFAEG-master/ODFAEG-master/ODFAEG/extlibs/headers/entt.hpp:16452)

1 0x4facba entt::basic_storage<entt::entity, entt::entity, std::allocator, void>::emplace(this=0x441fcbc) (../../ODFAEG-master/ODFAEG-master/ODFAEG/extlibs/headers/entt.hpp:17974)

2 0x4f0650 entt::sigh_mixin<entt::basic_storage<entt::entity, entt::entity, std::allocator, void> >::emplace(this=0x441fcbc) (../../ODFAEG-master/ODFAEG-master/ODFAEG/extlibs/headers/entt.hpp:24437)

3 0x501602 entt::basic_registry<entt::entity, std::allocator >::create(this=0x441fc68) (../../ODFAEG-master/ODFAEG-master/ODFAEG/extlibs/headers/entt.hpp:38205)

4 0x521692 odfaeg::graphic::ecs::EntityFactory::createEntity(this=0x441fc48, groupName=...) (C:/Program Files (x86)/ODFAEG/include/odfaeg/Core/entityFactory.hpp:14)

5 0x48c52e odfaeg::physic::ecs::ParticleSystem::ParticleSystem(this=0xffd0048, position=..., size=..., cmapping=...) (C:\Users\Laurent et Christian\ODFAEG-master\ODFAEG-master\ODFAEG\src\odfaeg\Physics\ECS\particleSystem.cpp:77)

6 0x4057f7 sorrok::MyECSAppli::onInit(this=0x441fbb0) (C:\Users\Laurent et Christian\ODFAEG-master\ODFAEG-master\Demos\ODFAEGDemoECS\application.cpp:146)

7 0x514826 odfaeg::core::ecs::Application::init(this=0x441fbb0) (C:/Program Files (x86)/ODFAEG/include/odfaeg/Graphics/ECS/application.hpp:515)

8 0x51465c odfaeg::core::ecs::Application::exec(this=0x441fbb0) (C:/Program Files (x86)/ODFAEG/include/odfaeg/Graphics/ECS/application.hpp:474)

9 0x407fde main() (C:\Users\Laurent et Christian\ODFAEG-master\ODFAEG-master\Demos\ODFAEGDemoECS\main.cpp:8)

skypjack commented 1 day ago

This is literally impossible to understand. Please, don't use the single include file if you want to post a log. Anyway, what version of EnTT is it? Do you have a repro? It could be anything, like a moved-from registry or who knows what.

LaurentDuroisin7601 commented 1 day ago

The problem was in my code now it works I close the issue.