diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2016-11-10 12:35:49 +0100 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2016-11-11 13:46:10 +0100 |
commit | 822b83ae4e0308f6f84c1955afbd27f753cfba12 (patch) | |
tree | dd47005b705c35369ebf16468420f5ff24e52828 /platform/android/src/style/sources/source.cpp | |
parent | 3a4a27c95f1c10c480532c46c4edb7b3120b7a2b (diff) | |
download | qtlocation-mapboxgl-822b83ae4e0308f6f84c1955afbd27f753cfba12.tar.gz |
[android] fix source ownership
Diffstat (limited to 'platform/android/src/style/sources/source.cpp')
-rw-r--r-- | platform/android/src/style/sources/source.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/platform/android/src/style/sources/source.cpp b/platform/android/src/style/sources/source.cpp index f3daa777d1..24fce79e94 100644 --- a/platform/android/src/style/sources/source.cpp +++ b/platform/android/src/style/sources/source.cpp @@ -35,6 +35,19 @@ namespace android { return jni::Make<jni::String>(env, source.getID()); } + void Source::addToMap(mbgl::Map& _map) { + //Check to see if we own the source first + if (!ownedSource) { + throw std::runtime_error("Cannot add source twice"); + } + + //Add source to map + _map.addSource(releaseCoreSource()); + + //Save pointer to the map + this->map = &_map; + } + std::unique_ptr<mbgl::style::Source> Source::releaseCoreSource() { assert(ownedSource != nullptr); return std::move(ownedSource); |