Code Monkey home page Code Monkey logo

Comments (6)

jkuhlmann avatar jkuhlmann commented on May 28, 2024

Can you confirm that PR #160 would fix this?

from cgltf.

NeilBickford-NV avatar NeilBickford-NV commented on May 28, 2024

To help out with this, I looked through all the occurrences of options->file.release and options->memory.free in cgltf.h. Assuming file.release and memory.free are not intended to be interchangeable (based on the issue #94 discussion here), then there may be two issues:

  • cgltf_parse_file() gets a file_data pointer using file.read above. But this pointer is later passed to either memory_free here if the parse fails, or passed to file.release in cgltf_free() here. (Looks like Johannes posted a fix right as I was writing this - I'll test it out!)
  • When reading buffers, buffers stored in files are read using file.read here, but Base64 buffers are decoded to a buffer allocated using memory.alloc here. Both of these appear to be released using file.release in cgltf_free() here (there's a special case for the .glb binary section which gets handled correctly!)

Also - thanks very much; I'll test out the PR and hopefully it should fix the cgltf_parse_file() issue!

from cgltf.

jkuhlmann avatar jkuhlmann commented on May 28, 2024

Funny that this all comes up now. Your second bullet point is the same as #158, is that correct?

from cgltf.

NeilBickford-NV avatar NeilBickford-NV commented on May 28, 2024

Oh, yep, looks like that is indeed the same issue!

Also, I can confirm that PR #160 fixes the cgltf_parse_file() issue with custom file callbacks and invalid glTF files - thank you, Johannes!

from cgltf.

jkuhlmann avatar jkuhlmann commented on May 28, 2024

I think in that case we don't have much of a choice except for tracking where the data comes from. I've added another change to #160. Does that help?

from cgltf.

pixeljetstream avatar pixeljetstream commented on May 28, 2024

we didn't run into #158 but your fixes looks good

from cgltf.

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.