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

Heap use after free in examples #35

Closed
raysan5 opened this issue Apr 29, 2018 · 0 comments
Closed

Heap use after free in examples #35

raysan5 opened this issue Apr 29, 2018 · 0 comments
Assignees

Comments

@raysan5
Copy link
Contributor

raysan5 commented Apr 29, 2018

Related issues: raysan5/raylib#485 and raysan5/raylib#486

As stated by another user by mail, those issues seem related to:

...when you call reset the code is still running in the thread... so while it iterating over the items, suddenly they are removed and of course you will get floating point errors and access violations. Also destroying and item while iterating over the list, will cause these problems too.

...basically in a thread environment, you have to project critical sections with semaphores.... I basically flatten the PhysicsLoop into a routine called PhysicsThread... and then have my own loop that calls PhysicsThread and I wrap this in critical sections (pseudocode:

procedure physics_loop
begin
    repeat 
        lock.enter;
        PhysicsThread;
        lock.leave
    until done = true;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants