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

Segmentation fault on program close #6

Open
ilumary opened this issue Feb 8, 2023 · 0 comments
Open

Segmentation fault on program close #6

ilumary opened this issue Feb 8, 2023 · 0 comments

Comments

@ilumary
Copy link

ilumary commented Feb 8, 2023

Describe the bug
The program throws a segmentation fault on default exit.

To Reproduce
Paste the reproduction code snippet below:

#include "co_ecs.hpp"

struct s1 {
    uint32_t i1;
    uint64_t i2;
};

struct s2 {
    float f1;
    int i1;
};

struct s3 {
    char c, e;
};

void test_create(ecs::registry& reg) {
    auto a = reg.create<s1, s3>({1, 2}, {92, 93});
    auto b = reg.create<s1, s3>({7, 3}, {75, 76});
    auto c = reg.create<s2>({});
}

int main() {
    ecs::registry reg;
    test_create(reg);
    return 0;
}

Observed behavior
The segfault is caused by the destructor call inside the destructor of the chunk class. Specifically this line:

block.meta.type->destruct(_buffer + block.offset + i * block.meta.type->size);

Environment

  • OS: MacOS 13.1
  • Arch: arm64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant