Skip to content

MacOS/JVM: crash when the map is removed from the UI during a transition #716

@TheLortex

Description

@TheLortex

What happened?

If a transition is happening while the map composable is removed, the program crashes with a SIGSEGV:

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000140b06d8c, pid=85827, tid=87335
#
# JRE version: OpenJDK Runtime Environment JBR-21.0.5+8-762.40-nomod (21.0.5+8) (build 21.0.5+8-b762.40)
# Java VM: OpenJDK 64-Bit Server VM JBR-21.0.5+8-762.40-nomod (21.0.5+8-b762.40, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# C  [libmaplibre-jni.dylib+0xe6d8c]  mbgl::Map::cancelTransitions()+0x10
#

While programming the repro, I couldn't obtain the exact same issue, but a probably related one:

#  SIGSEGV (0xb) at pc=0x000000013ca9f3a8, pid=86115, tid=90131
#
# JRE version: OpenJDK Runtime Environment JBR-21.0.5+8-762.40-nomod (21.0.5+8) (build 21.0.5+8-b762.40)
# Java VM: OpenJDK 64-Bit Server VM JBR-21.0.5+8-762.40-nomod (21.0.5+8-b762.40, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# C  [libmaplibre-jni.dylib+0xeb3a8]  non-virtual thunk to mbgl::Map::Impl::onTileAction(mbgl::TileOperation, mbgl::OverscaledTileID const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)+0x28

Affected Platforms

  • Android
  • iOS
  • Desktop (JVM)
  • Browser (JS)
  • Browser (Wasm)

Platform Version

macOS 26.0.1

Library Version

0.12.1

Sample Code

@Composable
fun BugRepro() {
    val cameraState = rememberCameraState()
    val coroutineScope = rememberCoroutineScope()
    var showMap by remember { mutableStateOf(true) }
    Column {
        Button(onClick = {
            coroutineScope.launch {
                cameraState.animateTo(CameraPosition(target = Position(2.0, 49.3), zoom = 10.0))
                showMap = false
                delay(1000)
                showMap = true
            }
        }) {
            Text("crash")
        }
        if (showMap) {
            MaplibreMap(
                cameraState = cameraState,
            )
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    desktopAffects Desktop in particular, or relates to Desktop specific code

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions