Skip to content

Double-check dangling pointers for getChildren() and getStyle() #1

Open

Description

@andreamancuso

ChatGPT suggested the following:

const char* getChildren(int id) {
    Runner* pRunner = Runner::getInstance();
    static std::string result; // Static to avoid dangling pointers
    result = IntVectorToJson(pRunner->GetChildren(id)).dump();
    return result.c_str();
}

const char* getStyle() {
    Runner* pRunner = Runner::getInstance();
    static std::string result; // Static to avoid dangling pointers
    result = pRunner->GetStyle();
    return result.c_str();
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions