Code Monkey home page Code Monkey logo

Comments (6)

AndresTraks avatar AndresTraks commented on September 2, 2024

Hi!

I test the demos quite frequently, but haven't seen this kind of crash recently. Can't reproduce it now either. Are you using your branch or did you try mine as well?
I'll go check the object references and stuff so that nothing gets disposed prematurely.

Thanks for reporting!

from bulletsharp.

gepa21 avatar gepa21 commented on September 2, 2024

Ok, i have been digging this all day and end up in bullet3 giving crappy pointers when trying to get Native->getChildList() when trying to add a shape in compound shape, which did not make sense.
I deleted, checkout and rebuild everything and now demos work fine :)

The problem is that it still crashes in my project, but i tracked the problem in adding wheels to raycast vehicle (next world simulation tick crashes with "Attempted to read or write protected memory.)
Up to the commit made at Jun 22, 2014 everything works, after that i get crashes.

Anyway bulletsharp/demos work ok after -all (sorry for the inconvenience) , so i will continue investigating my crashes.

Thanks :)

PS. i am using your branch

from bulletsharp.

AndresTraks avatar AndresTraks commented on September 2, 2024

The entire child list in btCompoundShape is reallocated when the underlying btAlignedObjectArray decides to allocate another chunk for additional children. So this makes getChildList() sometimes return different values. There's code to handle this here: https://github.com/AndresTraks/BulletSharp/blob/master/src/Collections.cpp#L335

from bulletsharp.

gepa21 avatar gepa21 commented on September 2, 2024

I finally found the problem ! (the fix here #3)
This bug arose from the changes in design/architecture that has to do with destruction (and garbage collection)

eg. I initialize my vehicle like this
Vehicle = new BulletSharp.RaycastVehicle(Tuning, chassis, new BulletSharp.DefaultVehicleRaycaster(physics_scene.World));

which means i do not keep a reference to raycaster in my class.. so the the wrapper class will be collected by garbage collector.. after the commit made at Jun 22, 2014 the raycaster class is now disposable(+destructor) which delete the native object and since vehicle did not keep a reference, it would be collected.

I believe other crashes i see are rooted to this issue...
I think that classes having destructor which frees the native object is a very good change and thing to have, but the object must keep a reference of the other destructable objects it needs.

Thanks :)

from bulletsharp.

gepa21 avatar gepa21 commented on September 2, 2024

Hunting down another crash let me to PersistentManifolds.
PersistentManifold inherit from TypedObject and they now got a destructor which deletes the native pointer when done. The bug was creating a PersistentManifold for unmanaged objects that would be delete (maybe even more that once) when it was time to collect the wrapper.

I added a flag in TypedObject to choose if should be delete. (fix here #4)

This fixed then crashes in my project and things seem to run smooth now.

If i find anything else i'll let you know :)

from bulletsharp.

AndresTraks avatar AndresTraks commented on September 2, 2024

Hey, nice work! :)

VehicleDemo doesn't crash because it actually implements it's own equivalent vehicle class (CustomVehicle) on top of IActionInterface, So it's not using RaycastVehicle at all. I think I'll rewrite RaycastVehicle to be fully managed just like CustomVehicle.

from bulletsharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.