Giter Site home page Giter Site logo

Comments (7)

flagarde avatar flagarde commented on September 20, 2024 2

@certik @TobiasWallner Should be fixed now

from cpp-terminal.

TobiasWallner avatar TobiasWallner commented on September 20, 2024 2

I just tried it and it works like a charm again, thx

from cpp-terminal.

flagarde avatar flagarde commented on September 20, 2024 1

@certik @TobiasWallner I fully agree with all your comments. Sorry for this stupid change, will move back to string

from cpp-terminal.

certik avatar certik commented on September 20, 2024

That code:

      m_Type = Type::CopyPaste;
      m_container.m_string.reset(new char[str.size() + 1]);
      std::copy(str.begin(), str.end(), m_container.m_string.get());
      m_container.m_string.get()[str.size()] = '\0';
      return;

should not be written like this. First of all, one should not use "new" by hand like this, since it usually leads to leaks and segfaults, possibly even causing the issue that you've seen. Second, as you said, this doesn't seem efficient. Why can't we simply append to the string?

from cpp-terminal.

TobiasWallner avatar TobiasWallner commented on September 20, 2024

Why can't we simply append to the string?

or assign

from cpp-terminal.

certik avatar certik commented on September 20, 2024

@flagarde awesome, thanks! No worries, this should be easy to fix.

from cpp-terminal.

flagarde avatar flagarde commented on September 20, 2024

I tested quickly on linux but please have a try too because string inside union it's a bit tricky

from cpp-terminal.

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.