You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The memory_handler.utils.memrange_iter doesn't properly handle freed entities.
It is casting the void pointer to unsigned int and checks for -1 instead of using the value located at that pointer address. That one is simple to fix like:
...
cdef unsigned int* pointer
if current >= self.end:
raise StopIteration
else:
pool_index = memory_zone.get_pool_index_from_index(current)
used = memory_zone.get_pool_end_from_pool_index(pool_index)
if current >= used:
self.current = memory_zone.get_pool_range(pool_index)[1] + 1
return next(self)
else:
pointer = <unsigned int*>memory_zone.get_pointer(current)
self.current += 1
if pointer[0] == <unsigned int>-1:
return next(self)
...
The python side of things has a somewhat related problem as StaticMemGameSystem.components returns entities that a) have the entity_id set to -1 (were once used and are freed atm) and b) also returns never used entities (the entity_id and everything else being 0).
IMHO in both cases the python side of things should get a None.
I am not sure how to handle this one. One way would be to initially set every entity_id to -1, but it would propably be nicer to simple not return never used entites (which as far as i understand can only be entities on the tail anyway).
The text was updated successfully, but these errors were encountered:
It is casting the void pointer to unsigned int and checks for -1 instead of using the value located at that pointer address. That one is simple to fix like:
IMHO in both cases the python side of things should get a None.
I am not sure how to handle this one. One way would be to initially set every entity_id to -1, but it would propably be nicer to simple not return never used entites (which as far as i understand can only be entities on the tail anyway).
The text was updated successfully, but these errors were encountered: