summaryrefslogtreecommitdiff
path: root/src/mbgl/style/style.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-05-04 15:40:17 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-05-05 09:23:01 -0700
commitdd353a60d1656f13351e8caa69e902b7f3111a02 (patch)
tree76f94fe164b7d320ea30b575df374f2e17b652d0 /src/mbgl/style/style.cpp
parent54b7684baadbf6d2af559b42f10dae55d3de6354 (diff)
downloadqtlocation-mapboxgl-dd353a60d1656f13351e8caa69e902b7f3111a02.tar.gz
[core] Reset observers of removed Sources and Layers
This ensures that the observer is not an invalid reference if the removed Source/Layer is retained, but the Style is deallocated.
Diffstat (limited to 'src/mbgl/style/style.cpp')
-rw-r--r--src/mbgl/style/style.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index d2821751be..63fb602616 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -192,6 +192,7 @@ std::unique_ptr<Source> Style::removeSource(const std::string& id) {
});
auto source = std::move(*it);
+ source->baseImpl->setObserver(nullptr);
sources.erase(it);
updateBatch.sourceIDs.erase(id);
@@ -264,6 +265,7 @@ std::unique_ptr<Layer> Style::removeLayer(const std::string& id) {
customLayer->impl->deinitialize();
}
+ layer->baseImpl->setObserver(nullptr);
layers.erase(it);
removeRenderLayer(id);
return layer;