Closed iamPHEN closed 8 years ago
As another note: The app is valid when complied on windows with MSVC15 and doesn't segfault on exit.
I'm curious as to why that is, but that's a bit off topic :).
According to this post, members should be constructed in the order they appear, and destructed in reverse order. If that is not the case, it seems that this is a compiler bug.
Ah. I was trying to dig for that. Awesome. I'm fine with closing this issue then since the standard recognizes it that way.
Sounds like a MSVC bug then, or me just being lucky that the Signal was still valid after deconstruction of the event manager.
Closing issue.
I ran into a slight usage issue issue with the following
App
:What happens here is:
~App()
is called~EventManager()
gets called, all signal handlers get destructed.~EntityManager()
callsEntityManager::reset()
, which emitsEntityDestroyedEvent
This caused a SEGFAULT in a weird spot during EntityManager::emit<entityx::EntityDestroyedEvent, entityx::Entity>(entityx::Entity&&).
Possible solution (not sure whats best) :
EntityManager
hold a share_ptr toEventManager
.destroy_no_events(..)
orsilent_destroy()
for use cases of destroying a entity without a validEventManager
.App
such that~EventManager()
comes after~EntityManager()
.