SIGN IN SIGN UP

fix(offline): serialize tileRegionPacks access on main and keep OfflineManager alive until its tasks complete (#4253)

The loadStylePack/loadTileRegion progress callbacks are delivered on
Mapbox SDK background threads ("com.mapbox.common.MB TileStore RW") and
mutated the tileRegionPacks dictionary concurrently with the main
thread, corrupting it and aborting with "object deallocated with
non-zero retain count" or malloc "pointer being freed was not
allocated". The RCT methods (getPackStatus, resumePackDownload,
pausePackDownload, deletePack) run on the module's background method
queue and touched the same state, as did convertRegionsToJSON's
TileStore callbacks. All of these now hop to the main queue, matching
the completion handlers.

Also keep the function-local OfflineManager alive until both of the
async tasks it started complete: it was deallocated ~0ms after
startLoading returned, before the style pack load finished.

Fixes #4252
M
Miklós Fazekas committed
e4979125f69be50d38f3d14f4d7fc46926f28407
Parent: 68a420c
Committed by GitHub <noreply@github.com> on 7/12/2026, 10:02:16 PM