From 3bb4ca50e609cbfd14c7bff7ae0bf7282d3cbbf1 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Tue, 3 Dec 2024 10:59:27 +0900 Subject: [PATCH 1/2] Fixes modifying state during view update --- Sources/MapLibreSwiftUI/MapViewCoordinator.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/MapLibreSwiftUI/MapViewCoordinator.swift b/Sources/MapLibreSwiftUI/MapViewCoordinator.swift index ee5c93c..304f985 100644 --- a/Sources/MapLibreSwiftUI/MapViewCoordinator.swift +++ b/Sources/MapLibreSwiftUI/MapViewCoordinator.swift @@ -357,7 +357,9 @@ public class MapViewCoordinator: NSObject, MLNMapV direction: mapView.direction, reason: CameraChangeReason(reason)) snapshotCamera = newCamera - parent.camera = newCamera + DispatchQueue.main.async { + self.parent.camera = newCamera + } } /// The MapView's region has changed with a specific reason. From be097b1bbe1222594e24087c1726f3983d44b54b Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Tue, 3 Dec 2024 11:00:36 +0900 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d3d2d6..b27b024 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Version 0.4.2 - 2024-12-03 + +### Fixed + +- Fixes a race modifying state during view update in rare cases + ## Version 0.4.1 - 2024-11-19 ### Fixed