Skip to content

Commit 95f2fc6

Browse files
authored
Merge pull request #2345 from gottesmm/rdar146378329
Add [weak self] in two places.
2 parents 888d88c + 43dd488 commit 95f2fc6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/SemanticIndex/TaskScheduler.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ package actor TaskScheduler<TaskDescription: TaskDescriptionProtocol> {
433433
priority: priority ?? Task.currentPriority,
434434
description: taskDescription,
435435
taskPriorityChangedCallback: { [weak self] (newPriority) in
436-
Task.detached(priority: newPriority) {
436+
Task.detached(priority: newPriority) { [weak self] in
437437
// If the task's priority got elevated, there might be an execution slot for it now. Poke the scheduler
438438
// to run the task if possible.
439439
await self?.poke()
@@ -442,11 +442,11 @@ package actor TaskScheduler<TaskDescription: TaskDescriptionProtocol> {
442442
executionStateChangedCallback: executionStateChangedCallback
443443
)
444444
pendingTasks.append(queuedTask)
445-
Task.detached(priority: priority ?? Task.currentPriority) {
445+
Task.detached(priority: priority ?? Task.currentPriority) { [weak self] in
446446
// Poke the `TaskScheduler` to execute a new task. If the `TaskScheduler` is already working at its capacity
447447
// limit, this will not do anything. If there are execution slots available, this will start executing the freshly
448448
// queued task.
449-
await self.poke()
449+
await self?.poke()
450450
}
451451
return queuedTask
452452
}

0 commit comments

Comments
 (0)