Skip to content

Avoid pointer to reference to temporaries in SetResource API #733

Description

@maxgolov

Repro Steps

  • Compile with standard library (STL) classes.
  • Run all tests: 335 tests passed; 10 tests failed (all related to SetResource API).

image

@lalitb - this is problematic spot. It won't work too well with temporaries because it's assigning a pointer to reference.

If Resource is compiled with std::variant. And a temporary is passed to API, e.g.

SetResource("key", "value")

It'd break.. Sorry, I found it just now. Haven't noticed during code review originally.. :( Now I tagged the spot in review below:

#706 (comment)_

Exact Problematic Test Spot

image

Same issue across all 10 tests.

How to Fix

We need to avoid a pointer to temporary here. Since Resource values are not changing often, perhaps a copy is more appropriate than a pointer?

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