diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-09-04 02:02:23 +0200 |
---|---|---|
committer | Dane Springmeyer <springmeyer@users.noreply.github.com> | 2019-09-03 17:02:23 -0700 |
commit | c7be3d52a709c98e93384bdcabc5cebc7adb9dac (patch) | |
tree | b9d36368491a8e03ecf435215a75a616b7059065 /src | |
parent | 1ef763c98e540b0a347cd59ab040a0449df4a14c (diff) | |
download | qtlocation-mapboxgl-c7be3d52a709c98e93384bdcabc5cebc7adb9dac.tar.gz |
Always call onSourceLoaded observers (#15548)
* [core] add sources to source collection before triggering load
* [test] add testcase for #15514
* [core] also call onSourceLoaded observers when no network request was necessary
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/style/sources/custom_geometry_source.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/style/sources/raster_source.cpp | 1 | ||||
-rw-r--r-- | src/mbgl/style/sources/vector_source.cpp | 1 | ||||
-rw-r--r-- | src/mbgl/style/style_impl.cpp | 5 |
4 files changed, 6 insertions, 3 deletions
diff --git a/src/mbgl/style/sources/custom_geometry_source.cpp b/src/mbgl/style/sources/custom_geometry_source.cpp index 6e9d8d65fb..73675c056f 100644 --- a/src/mbgl/style/sources/custom_geometry_source.cpp +++ b/src/mbgl/style/sources/custom_geometry_source.cpp @@ -1,6 +1,7 @@ #include <mbgl/style/sources/custom_geometry_source.hpp> #include <mbgl/style/custom_tile_loader.hpp> #include <mbgl/style/sources/custom_geometry_source_impl.hpp> +#include <mbgl/style/source_observer.hpp> #include <mbgl/actor/actor.hpp> #include <mbgl/actor/scheduler.hpp> #include <mbgl/tile/tile_id.hpp> @@ -25,6 +26,7 @@ const CustomGeometrySource::Impl& CustomGeometrySource::impl() const { void CustomGeometrySource::loadDescription(FileSource&) { baseImpl = makeMutable<CustomGeometrySource::Impl>(impl(), loader->self()); loaded = true; + observer->onSourceLoaded(*this); } void CustomGeometrySource::setTileData(const CanonicalTileID& tileID, diff --git a/src/mbgl/style/sources/raster_source.cpp b/src/mbgl/style/sources/raster_source.cpp index b4fbe22ae1..115887d004 100644 --- a/src/mbgl/style/sources/raster_source.cpp +++ b/src/mbgl/style/sources/raster_source.cpp @@ -41,6 +41,7 @@ void RasterSource::loadDescription(FileSource& fileSource) { if (urlOrTileset.is<Tileset>()) { baseImpl = makeMutable<Impl>(impl(), urlOrTileset.get<Tileset>()); loaded = true; + observer->onSourceLoaded(*this); return; } diff --git a/src/mbgl/style/sources/vector_source.cpp b/src/mbgl/style/sources/vector_source.cpp index 8fa694e4d0..f103a7768f 100644 --- a/src/mbgl/style/sources/vector_source.cpp +++ b/src/mbgl/style/sources/vector_source.cpp @@ -38,6 +38,7 @@ void VectorSource::loadDescription(FileSource& fileSource) { if (urlOrTileset.is<Tileset>()) { baseImpl = makeMutable<Impl>(impl(), urlOrTileset.get<Tileset>()); loaded = true; + observer->onSourceLoaded(*this); return; } diff --git a/src/mbgl/style/style_impl.cpp b/src/mbgl/style/style_impl.cpp index 10fee73cdd..d3298c5cac 100644 --- a/src/mbgl/style/style_impl.cpp +++ b/src/mbgl/style/style_impl.cpp @@ -140,9 +140,8 @@ void Style::Impl::addSource(std::unique_ptr<Source> source) { } source->setObserver(this); - source->loadDescription(fileSource); - - sources.add(std::move(source)); + auto item = sources.add(std::move(source)); + item->loadDescription(fileSource); } std::unique_ptr<Source> Style::Impl::removeSource(const std::string& id) { |