summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-05-11 10:35:45 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-05-12 11:26:27 -0700
commitafead4e749794e6d0f6b9cb9bd7897face64104a (patch)
tree95e375dbf3c4d4c8ad3cf59c50b176dc532e131e /include
parent54e26b20e7d64e1c4497ef3c411230fe708851b6 (diff)
downloadqtlocation-mapboxgl-afead4e749794e6d0f6b9cb9bd7897face64104a.tar.gz
[core] Return {Source,Layer}::getID by value
Avoid dangling references in the following sequence: auto& id = layer->getID(); layer->setMaxZoom(2); std::cout << id; The reference would be dangling because mutating the layer allocates a new Immutable impl, and there may be no references to the prior impl, which held the id.
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/style/layer.hpp2
-rw-r--r--include/mbgl/style/source.hpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp
index 10176879c5..61706d400b 100644
--- a/include/mbgl/style/layer.hpp
+++ b/include/mbgl/style/layer.hpp
@@ -92,7 +92,7 @@ public:
}
LayerType getType() const;
- const std::string& getID() const;
+ std::string getID() const;
// Visibility
VisibilityType getVisibility() const;
diff --git a/include/mbgl/style/source.hpp b/include/mbgl/style/source.hpp
index d19dfd4e36..cec9619451 100644
--- a/include/mbgl/style/source.hpp
+++ b/include/mbgl/style/source.hpp
@@ -56,7 +56,7 @@ public:
}
SourceType getType() const;
- const std::string& getID() const;
+ std::string getID() const;
optional<std::string> getAttribution() const;
// Private implementation