Saturday, February 10, 2024

WSPR Watch 4.10 - fixed a long standing thread crash

WSPR Watch, my iOS app for quickly looking at spots on WSPRnet, is 12 years old. During that time it has been updated as the software tools and frameworks have changed.

First it was Objective C and UIKit. Next came the move to Swift. Version 4 was a move to SwiftUI.

I've always used background threads for doing the time-consuming requests to the different data sources. Most recently I've been using async/await and Actors. 

When I moved the app from storyboards to SwiftUI about half of the old code was no longer required. Things look much neater now. For a long time I've had a few crash reports coming in. These have been mostly in the map view. This app really hammers the map by drawing, sometimes, 10,000 or more overlays on it. 

I'd heard of the ThreadSanitiser that is part of the LLVM toolchain and available in Xcode. When I turned it on and ran the app in a Simulator it quickly showed me three data races that I hadn't noticed. My mistake was adding to an Array from a background thread when that Array was also available from other threads.

Having fixed these, I am now seeing zero crashes from users of version 4.9 and later. I expect to see a few due to being out of memory of killed in other ways but so far it looks good.

My thanks, as always, to my wonderful testers and users for their suggestions.

No comments: