Giter VIP home page Giter VIP logo

Comments (5)

jdduke avatar jdduke commented on May 16, 2024

The IOStream can either be deleted explicitly, or closed via IOHandler::Close; in theory, they should accomplish the same thing. However, that seems overly ambiguous, and places an unnecessary burden on implementers of IOStream/IOHandler to properly handle both use-cases.

What if instead, we always returned a scoped_ptr from IOHandler::Open, removed the IOHandler::Close method completely, and made the IOStream destructor solely responsible for cleanup. Thoughts? This enforces consistent usage for all clients of IOHandler.

from assimp.

acgessler avatar acgessler commented on May 16, 2024

A std::unique_ptr would probably be a solution, unfortunately we cannot switch to C++11 for any forseeable future. A scoped_ptr is not intended to be returned at all (and without move semantics it makes no sense either).

Personally, I would just drop the Close() and let the destructor do it.

from assimp.

jdduke avatar jdduke commented on May 16, 2024

Yeah, that sounds reasonable.

from assimp.

danielesegato avatar danielesegato commented on May 16, 2024

I actually call Close on the destructor. So I also agree Close can go. But the issue remain because the IOStream is never destructed.

I currently worked around it by keeping an instance of the IOStream I create in IOSystem and destroy it when IOSystem is destroyed or before opening a new one...

it's probably wrong for some use case but works for mine because I have to load only one IOStream at the time.

from assimp.

danielesegato avatar danielesegato commented on May 16, 2024

Ok, I take it partially back.

Close is never called.

But the destructor of the IOStream is

from assimp.

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.