Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/com/mapconductor/mappls/MapplsMapView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ fun MapplsMapView(
// For now, assuming content relates to overlay definitions.
style = style,
onStyleDiagnostics = onStyleDiagnostics,
// Never started (onStart is not called), so it is not stopped either --
// MapView.onStop() would deactivate the shared FileSource the next map
// still uses. Destroying it ends the render thread, whose camera
// listeners otherwise keep the controller and every overlay alive.
onDestroyMapView = { mapView -> mapView.onDestroy() },
content = content, // This might need adjustment based on how overlays are handled
)
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/mapconductor/mappls/MapplsViewStateImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ class MapplsViewState(
cameraPosition: MapCameraPosition = MapCameraPosition.Default,
) : MapViewState<MapplsMapDesignTypeInterface>(cameraPosition),
MapplsViewStateInterface {
private var controller: MapplsViewControllerInterface? = null
// Read through the base so that letting go of the controller there (MapViewBase
// does it when the map is torn down) leaves nothing behind here.
private val controller: MapplsViewControllerInterface?
get() = attachedMapController as? MapplsViewControllerInterface
private var _mapDesignType: MapplsMapDesignTypeInterface = mapDesignType

override var mapDesignType: MapplsMapDesignTypeInterface
Expand All @@ -32,7 +35,6 @@ class MapplsViewState(
get() = _mapDesignType

internal fun setController(controller: MapplsViewControllerInterface) {
this.controller = controller
attachController(controller)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ class MapplsPolygonConductor(
}

override fun destroy() {
// No native resources to clean up for polygons
// A destroyed conductor can still be referenced (by its map controller,
// or a state that has not let go yet); without this it keeps every entity.
polygonOverlay.polygonManager.clear()
polylineOverlay.polylineManager.clear()
}
}

Expand Down
Loading