[android] shutting down thread pool of the CustomGeometrySource when the source is destroyed

This commit is contained in:
Łukasz Paczos
2018-07-31 19:42:09 +02:00
committed by Łukasz Paczos
parent b500577bfa
commit 63d4ac05f2
8 changed files with 198 additions and 26 deletions

View File

@@ -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;
}