Skip to content

Conversation

@AiraYumi
Copy link
Contributor

By returning the actual object instead of the temporary object's LLSD, we prevent reading undefined areas.

@github-actions github-actions bot added the c/cpp label Nov 23, 2025
if ( pContent.has(NAVMESH_DATA_FIELD) )
{
const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary();
LLSD::Binary value = pContent.get(NAVMESH_DATA_FIELD).asBinary();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest this method to suppress the related compiler warning. It avoids creating an additional copy of the binary data vector.

Suggested change
LLSD::Binary value = pContent.get(NAVMESH_DATA_FIELD).asBinary();
LLSD nav_data = pContent.get(NAVMESH_DATA_FIELD);
const LLSD::Binary& value = nav_data.asBinary();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I refixed it.

@akleshchev
Copy link
Contributor

Thank you. Is there anything our QA can test?

I see that it's navmesh related and that .asBinary() returned an object that can expire before newStr, but I'm not sure what scenario this can be tested in?

@akleshchev akleshchev merged commit 0fa5991 into secondlife:develop-linux Nov 25, 2025
8 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 25, 2025
@secondlife secondlife unlocked this conversation Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevent the creation of temporary objects that will be discarded.

3 participants