Browse Source

pgraph: make ParamNodePath::get_value() return a copy

See #554.
rdb 6 years ago
parent
commit
9d42e25539

+ 1 - 1
panda/src/pgraph/paramNodePath.I

@@ -40,7 +40,7 @@ get_value_type() const {
 /**
  * Retrieves the NodePath stored in the parameter.
  */
-INLINE const NodePath &ParamNodePath::
+INLINE NodePath ParamNodePath::
 get_value() const {
   return _node_path;
 }

+ 1 - 1
panda/src/pgraph/paramNodePath.h

@@ -30,7 +30,7 @@ PUBLISHED:
   INLINE ParamNodePath(NodePath &&node_path) noexcept;
 
   INLINE virtual TypeHandle get_value_type() const;
-  INLINE const NodePath &get_value() const;
+  INLINE NodePath get_value() const;
 
   virtual void output(std::ostream &out) const;
 

+ 1 - 1
panda/src/pgraph/shaderAttrib.cxx

@@ -314,7 +314,7 @@ get_shader_input(const std::string &id) const {
  * Returns the ShaderInput as a nodepath.  Assertion fails if there is none,
  * or if it is not a nodepath.
  */
-const NodePath &ShaderAttrib::
+NodePath ShaderAttrib::
 get_shader_input_nodepath(const InternalName *id) const {
   static NodePath resfail;
   Inputs::const_iterator i = _inputs.find(id);

+ 1 - 1
panda/src/pgraph/shaderAttrib.h

@@ -115,7 +115,7 @@ PUBLISHED:
   const ShaderInput &get_shader_input(const InternalName *id) const;
   const ShaderInput &get_shader_input(const std::string &id) const;
 
-  const NodePath &get_shader_input_nodepath(const InternalName *id) const;
+  NodePath get_shader_input_nodepath(const InternalName *id) const;
   LVecBase4 get_shader_input_vector(InternalName *id) const;
   Texture *get_shader_input_texture(const InternalName *id, SamplerState *sampler=nullptr) const;
   const Shader::ShaderPtrData *get_shader_input_ptr(const InternalName *id) const;

+ 1 - 1
panda/src/pgraph/shaderInput.cxx

@@ -89,7 +89,7 @@ add_hash(size_t hash) const {
  * Warning: no error checking is done.  This *will* crash if get_value_type()
  * is not M_nodepath.
  */
-const NodePath &ShaderInput::
+NodePath ShaderInput::
 get_nodepath() const {
   return DCAST(ParamNodePath, _value)->get_value();
 }

+ 1 - 1
panda/src/pgraph/shaderInput.h

@@ -119,7 +119,7 @@ PUBLISHED:
   INLINE const LVecBase4 &get_vector() const;
   INLINE const Shader::ShaderPtrData &get_ptr() const;
 
-  const NodePath &get_nodepath() const;
+  NodePath get_nodepath() const;
   Texture *get_texture() const;
   const SamplerState &get_sampler() const;