[android] fix source ownership

This commit is contained in:
Ivo van Dongen
2016-11-10 12:35:49 +01:00
committed by Ivo van Dongen
parent 3a4a27c95f
commit 822b83ae4e
4 changed files with 39 additions and 3 deletions

View File

@@ -32,16 +32,23 @@ public:
virtual ~Source();
void addToMap(mbgl::Map&);
virtual jni::jobject* createJavaPeer(jni::JNIEnv&) = 0;
jni::String getId(jni::JNIEnv&);
protected:
//Release the owned view and return it
std::unique_ptr<mbgl::style::Source> releaseCoreSource();
protected:
//Set on newly created sources until added to the map
std::unique_ptr<mbgl::style::Source> ownedSource;
//Raw pointer that is valid until the source is removed from the map
mbgl::style::Source& source;
//Map pointer is valid for newly created sources only after adding to the map
mbgl::Map* map;
};