From 2762a6b3b58c319e0d1a6ceca5a49df3ea84823c Mon Sep 17 00:00:00 2001 From: Ian Leitch Date: Mon, 3 Jan 2022 17:38:35 +0000 Subject: [PATCH] Fix concurrent mutation crash while indexing. Closes #450 & #451 (#452) --- CHANGELOG.md | 2 +- Sources/PeripheryKit/Indexer/SwiftIndexer.swift | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc4245652..a2958ca54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ ##### Bug Fixes -- None. +- Fix a crash while indexing. ## 2.8.4 (2021-12-30) diff --git a/Sources/PeripheryKit/Indexer/SwiftIndexer.swift b/Sources/PeripheryKit/Indexer/SwiftIndexer.swift index 67612c195..0b3e3bd26 100644 --- a/Sources/PeripheryKit/Indexer/SwiftIndexer.swift +++ b/Sources/PeripheryKit/Indexer/SwiftIndexer.swift @@ -285,8 +285,10 @@ public final class SwiftIndexer { continue } - for ref in refs { - associateUnsafe(ref, with: decl) + graph.mutating { + for ref in refs { + associateUnsafe(ref, with: decl) + } } } }