Skip to content

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

@andreamancuso

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();
}

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