Skip to content

qt5cpp model arguments in DefaultAPI methods should be pointers or passed by reference. #1475

Open
@baverbud

Description

@baverbud

The qt5cpp generator creates a method signature like this in SWGDefaultAPI:

void profileRoutePost(SWGProfile_route_body body, QString* token);

In C/CPP, this will cause 'body' to be copied. There is no proper copy constructor created for the models however, so pointers are re-used instead of new members being allocated.

When profileRoutePost returns, it will destroy the new copy of body and free the pointers. When the application eventually frees the original SWGProfile_route_body in the calling code, it will try to free the same pointers again, causing a segmentation fault due to a double free.

Performance wise, it's also really inefficient to be copying these objects unless that's really needed. Either passing by reference or pointer would fix the segfault and the unneeded copy.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions