[libaryloader] synchronise access to the library loader load method (#58)

This commit is contained in:
Tobrun
2019-11-18 07:22:50 +01:00
committed by GitHub
parent 6cebb51747
commit 8b20a92880
3 changed files with 9 additions and 4 deletions

View File

@@ -2,6 +2,10 @@
Mapbox welcomes participation and contributions from everyone. If you'd like to do so please see the [`Contributing Guide`](https://github.com/mapbox/mapbox-gl-native/blob/master/CONTRIBUTING.md) first to get started.
## Master
### Bugs
- Synchronise LibaryLoader#loadLibrary to avoid race conditions resulting in UnsatisfiedLinkError [#58](https://github.com/mapbox/mapbox-gl-native-android/pull/58)
## 8.6.0-alpha.1 - November 14, 2019
[Changes](https://github.com/mapbox/mapbox-gl-native-android/compare/android-v8.5.0...android-v8.6.0-alpha.1) since [Mapbox Maps SDK for Android v8.5.0](https://github.com/mapbox/mapbox-gl-native-android/releases/tag/android-v8.5.0):
### Features

View File

@@ -5,7 +5,7 @@ import com.mapbox.mapboxsdk.log.Logger;
/**
* Loads the mapbox-gl shared library
* <p>
* By default uses the {@link System#loadLibrary(String)},
* By default uses SoLoader from https://github.com/facebook/SoLoader
* use {@link #setLibraryLoader(LibraryLoader)} to provide an alternative library loading hook.
* </p>
*/
@@ -36,7 +36,7 @@ public abstract class LibraryLoader {
* Catches UnsatisfiedLinkErrors and prints a warning to logcat.
* </p>
*/
public static void load() {
public static synchronized void load() {
try {
if (!loaded) {
loaded = true;

View File

@@ -12,7 +12,7 @@ import static com.facebook.soloader.SoLoader.loadLibrary;
/**
* Concrete implementation of a native library loader.
* <p>
* Uses ReLinker from https://github.com/KeepSafe/ReLinker.
* Uses SoLoader from https://github.com/facebook/SoLoader.
* </p>
*/
public class LibraryLoaderProviderImpl implements LibraryLoaderProvider {
@@ -28,7 +28,7 @@ public class LibraryLoaderProviderImpl implements LibraryLoaderProvider {
}
/**
* Concrete implementation of a LibraryLoader using ReLinker.
* Concrete implementation of a LibraryLoader using SoLoader.
*/
private static class SoLibraryLoader extends LibraryLoader {
@@ -43,6 +43,7 @@ public class LibraryLoaderProviderImpl implements LibraryLoaderProvider {
} catch (MapboxConfigurationException exception) {
Logger.e(TAG, "Couldn't load so file with relinker, application context missing, "
+ "call Mapbox.getInstance(Context context, String accessToken) first");
throw new UnsatisfiedLinkError(exception.getMessage());
}
}
}