summaryrefslogtreecommitdiff
path: root/platform/android/src/style/sources/source.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/src/style/sources/source.cpp')
-rw-r--r--platform/android/src/style/sources/source.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/android/src/style/sources/source.cpp b/platform/android/src/style/sources/source.cpp
index 5f68e40467..8f14ebc43e 100644
--- a/platform/android/src/style/sources/source.cpp
+++ b/platform/android/src/style/sources/source.cpp
@@ -109,7 +109,7 @@ namespace android {
rendererFrontend = &frontend;
}
- void Source::removeFromMap(JNIEnv&, jni::Object<Source>, mbgl::Map& map) {
+ bool Source::removeFromMap(JNIEnv&, jni::Object<Source>, mbgl::Map& map) {
// Cannot remove if not attached yet
if (ownedSource) {
throw std::runtime_error("Cannot remove detached source");
@@ -119,6 +119,11 @@ namespace android {
ownedSource = map.getStyle().removeSource(source.getID());
// The source may not be removed if any layers still reference it
+ return ownedSource != nullptr;
+ }
+
+ void Source::releaseJavaPeer() {
+ // We can't release the peer if the source was not removed from the map
if (!ownedSource) {
return;
}