Skip to content

Commit 9e3c606

Browse files
authored
Merge pull request #27 from benlangmuir/crashhhh
Workaround corelibs-libdispatch crash SR-10319
2 parents b3b4bba + 6559e8b commit 9e3c606

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/Index/IndexDatastore.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -810,12 +810,19 @@ bool IndexDatastoreImpl::init(IndexStoreRef idxStore,
810810
Delegate->processingAddedPending(evts.size());
811811
eventsDeque->addEvents(evts);
812812

813-
// Create the block with QoS explicitly to ensure that the QoS from the indexstore callback can't affect the onFilesChange priority. This call may do a lot of I/O and we don't want to wedge the system by running at elevated priority.
814-
dispatch_block_t onUnitChangeBlock = dispatch_block_create_with_qos_class(DISPATCH_BLOCK_INHERIT_QOS_CLASS, unitChangesQOS, 0, ^{
813+
auto onUnitChangeBlockImpl = ^{
815814
// Pass registration events to be processed incrementally by the global serial queue.
816815
// This allows intermixing processing of registration events from multiple workspaces.
817816
processUnitEventsIncrementally(eventsDeque, WeakUnitRepo, Delegate, getGlobalQueueForUnitChanges());
818-
});
817+
};
818+
819+
#if defined(__APPLE__)
820+
// Create the block with QoS explicitly to ensure that the QoS from the indexstore callback can't affect the onFilesChange priority. This call may do a lot of I/O and we don't want to wedge the system by running at elevated priority.
821+
dispatch_block_t onUnitChangeBlock = dispatch_block_create_with_qos_class(DISPATCH_BLOCK_INHERIT_QOS_CLASS, unitChangesQOS, 0, onUnitChangeBlockImpl);
822+
#else
823+
// FIXME: https://bugs.swift.org/browse/SR-10319
824+
auto onUnitChangeBlock = Block_copy(onUnitChangeBlockImpl);
825+
#endif
819826
dispatch_async(getGlobalQueueForUnitChanges(), onUnitChangeBlock);
820827
Block_release(onUnitChangeBlock);
821828
};

0 commit comments

Comments
 (0)