Minimal fork of maplibre/maplibre-native
carrying a single patch on top of Android release
android-v13.0.2.
This repository only hosts the patch (source + binary) — it is not a full source mirror. Go to upstream for the rest of the tree.
13.0.2-li.2— current. Review-fixup revision of-li.1: privateImageManagerconstructor + staticcreate()factory, explanatory comment removed, and the same change rippled through all test TUs that previously constructedImageManagerviamake_shared/make_unique.13.0.2-li.1— original.enable_shared_from_this+weak_from_this()guard in the scheduledremovePendingRequestscallback. Left behind the public constructor, which the upstream reviewer pointed out was a footgun. Kept in the branches list for history.
android-v13.0.2-li.2— current patched source (3 files + the full diff against upstream 13.0.2).android-v13.0.2-li.1— original patch snapshot.maven-repo— pre-built AARs (all four ABIs) in Maven-standard layout for each version above. Served as a Maven repository viahttps://raw.githubusercontent.com/lineinspector/maplibre-native/maven-repo/.
ImageManager::checkMissingAndNotify schedules a removePendingRequests
callback via Scheduler::bindOnce. Upstream captures this by raw pointer.
When the Renderer / ImageManager is destroyed while the callback is still
queued on the Android render thread, the next invocation locks a destroyed
std::recursive_mutex and aborts:
FORTIFY: pthread_mutex_lock called on a destroyed mutex
std::__ndk1::recursive_mutex::lock()
mbgl::android::MapRendererRunnable::run
The fix makes ImageManager inherit std::enable_shared_from_this,
private-izes the constructor, exposes a ImageManager::create() static
factory, and captures weak_from_this() inside the callback. The callback
bails out before locking if the ImageManager is gone.
Android 16 on a Pixel 7a, maplibre-native 13.0.2 +
@maplibre/maplibre-react-native 11.0.0-beta.30, release build, React
Native New Architecture: open the real map screen, wait for
onStyleImageMissing to queue a callback (icons not yet loaded), then open
a @react-navigation/drawer. On some devices the drawer's
Reanimated-driven parent layout triggers a SurfaceView destroy/recreate
cycle, which runs MapRenderer::onSurfaceDestroyed -> resetRenderer -> Renderer dtor -> ImageManager dtor. The next queued MapRendererRunnable
then crashes.
PR open at maplibre/maplibre-native#4233.
Once merged and released, this repo can be retired — consumers go back to
the upstream org.maplibre.gl:android-sdk-opengl coordinate.
This fork is consumed by the Line Inspector mobile
app via the Expo config
plugin at apps/mobile/plugins/with-patched-maplibre.js.