Skip to content

Comments

Fix for a race condition in the usage of URLCache#4821

Open
maru-biz wants to merge 3 commits intolts/v2from
mr/urldatacache-fix
Open

Fix for a race condition in the usage of URLCache#4821
maru-biz wants to merge 3 commits intolts/v2from
mr/urldatacache-fix

Conversation

@maru-biz
Copy link
Contributor

Description

Fixed a randomly occurring race condition in the usage of URLCache.

Implementation

  • Synchronization for URLCache reads/writes.
  • Removed redundant updateMapStyle which was able to provoke a race condition.

Screenshots or Gifs

@maru-biz maru-biz added bug Something isn’t working v2.x Related to version 2.x. labels Feb 19, 2026
@maru-biz maru-biz marked this pull request as ready for review February 19, 2026 13:09
@maru-biz maru-biz requested a review from a team as a code owner February 19, 2026 13:09
@maru-biz maru-biz force-pushed the mr/urldatacache-fix branch 2 times, most recently from 047f593 to b98e7e3 Compare February 23, 2026 11:18
# Conflicts:
#	CHANGELOG.md
@maru-biz maru-biz force-pushed the mr/urldatacache-fix branch from b98e7e3 to d8a47d0 Compare February 23, 2026 14:27
@@ -47,6 +47,7 @@ internal class URLDataCache: URLCaching {

let urlCache: URLCache
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also mark the property as private to avoid accidentional access?

*/
internal class URLDataCache: URLCaching {
let defaultDiskCacheURL: URL = {
private static var defaultDiskCacheURL: URL {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any reasons to make it a var?
I don't see any usage of it in the pull request now. I assume it might be needed in tests for cleanup, but for such cases, you can either pass a non-nil diskCacheURL value to the initializer or clean up the default folder directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used in init (only), so I've changed it to computed property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn’t working v2.x Related to version 2.x.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants