diff options
author | David Robillard <d@drobilla.net> | 2025-02-10 15:33:57 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2025-02-10 16:07:44 -0500 |
commit | 415a68cbe8e68f909245b33f63af13e399a849f5 (patch) | |
tree | 0379dc738c545dad94baa7f87f629b60d0bd6302 /src | |
parent | 94c2c406a4494cde29c7150627248ba8ce2485df (diff) | |
download | ingen-415a68cbe8e68f909245b33f63af13e399a849f5.tar.gz ingen-415a68cbe8e68f909245b33f63af13e399a849f5.tar.bz2 ingen-415a68cbe8e68f909245b33f63af13e399a849f5.zip |
Avoid potentially returning a reference to a local
This case shouldn't happen anyway since it's handled at the caller, which is
best not only because of this issue, but because having set_property() maybe
not set the property is confusing.
Diffstat (limited to 'src')
-rw-r--r-- | src/Resource.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/Resource.cpp b/src/Resource.cpp index 362e6b08..29a82772 100644 --- a/src/Resource.cpp +++ b/src/Resource.cpp @@ -53,6 +53,8 @@ Resource::add_property(const URI& uri, const Atom& value, Graph ctx) const Atom& Resource::set_property(const URI& uri, const Atom& value, Resource::Graph ctx) { + assert(uri != _uris.ingen_activity); // Always ephemeral + // Erase existing property in this context for (auto i = _properties.find(uri); (i != _properties.end()) && (i->first == uri);) { @@ -66,16 +68,10 @@ Resource::set_property(const URI& uri, const Atom& value, Resource::Graph ctx) i = next; } - if (uri != _uris.ingen_activity) { - // Insert new property - const Atom& v = _properties.emplace(uri, Property(value, ctx))->second; - on_property(uri, v); - return v; - } - - // Announce ephemeral activity, but do not store - on_property(uri, value); - return value; + // Insert new property + const Atom& v = _properties.emplace(uri, Property(value, ctx))->second; + on_property(uri, v); + return v; } const Atom& |