Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

maplibre-native fork — LineInspector patch

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.

Versions

  • 13.0.2-li.2 — current. Review-fixup revision of -li.1: private ImageManager constructor + static create() factory, explanatory comment removed, and the same change rippled through all test TUs that previously constructed ImageManager via make_shared/make_unique.
  • 13.0.2-li.1 — original. enable_shared_from_this + weak_from_this() guard in the scheduled removePendingRequests callback. Left behind the public constructor, which the upstream reviewer pointed out was a footgun. Kept in the branches list for history.

Branches

  • 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 via https://raw.githubusercontent.com/lineinspector/maplibre-native/maven-repo/.

What the patch does

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.

Reproduction

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.

Upstream status

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.

Consumers

This fork is consumed by the Line Inspector mobile app via the Expo config plugin at apps/mobile/plugins/with-patched-maplibre.js.

About

Fork of maplibre/maplibre-native with ImageManager callback lifetime fix for Android drawer crash (upstream PR pending)

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages