-
-
Notifications
You must be signed in to change notification settings - Fork 441
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
Id record refcount goes below 0 in world fini after adding pairs with arbitrary target ids #951
Labels
bug
Something isn't working
Comments
Pasted the code here for visibility: #include "flecs.h"
using namespace flecs;
struct CComp1 {
int field;
};
struct CComp2 {
int field;
};
struct CComp3 {
int field;
};
int main(int argc, char *argv[]) {
auto World = flecs::world();
World.set_threads(1);
// Removing any of these stops the crash.
World.component<CComp1>();
World.component<CComp2>();
World.component<CComp3>();
// Removing any of these stops the crash.
auto Role1 = ecs_new_low_id(World.c_ptr());
auto Role2 = ecs_new_low_id(World.c_ptr());
ecs_bulk_desc_t BulkDesc = {};
// Making this lower stops the crash.
BulkDesc.count = 1331;
auto Entities = ecs_bulk_init(World.c_ptr(), &BulkDesc);
printf("last id: %lu\n", Entities[BulkDesc.count - 1]);
// < 272 is fine, < 273 leads to crash on ecs fini.
for (auto Index = 0u; Index < 273; ++Index) {
auto E = World.entity();
// 1983 can be changed to 1984 and still crash, not sure about this.
printf("adding (%lu, %lu) to %lu\n", (unsigned long)Role2, (unsigned long)1983 + Index, E.id());
E.add(ecs_pair(Role2, 1983 + Index));
}
return 0;
} |
|
SanderMertens
changed the title
Idr corruption through intensive relationship usage
Id record refcount goes below 0 in world fini after adding pairs with arbitrary target ids
Mar 29, 2023
SanderMertens
added a commit
that referenced
this issue
May 9, 2023
Fixed! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When using arbitraty id-s as targets of the relationship, corruptions occur in some scenarios, this is a 100% repro.
World destruction is not succesful, idr ref count reaches -1.
To Reproduce
The repro is located at https://github.com/Hexlord/flecs_test/blob/master/main.cpp
It is important that following defines are set in CMake:
Expected behavior
No asserts should happen.
The text was updated successfully, but these errors were encountered: