Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Commit9c395df

Browse files
author
Olexandr Belozierov
committed
- fixed leak inCoroutineScheduler.startCoroutine() when passCoScope.
1 parentc137153 commit9c395df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎Sources/SwiftCoroutine/Coroutine/TaskScheduler/CoroutineScheduler.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ extension CoroutineScheduler {
6767
/// - task: The closure that will be executed inside coroutine. If the task throws an error, then the coroutine will be terminated.
6868
publicfunc startCoroutine(in scope:CoScope?=nil, task:@escaping()throws->Void){
6969
guardlet scope= scopeelse{return_startCoroutine{try?task()}}
70-
_startCoroutine{
70+
_startCoroutine{[weak scope]in
7171
guardlet coroutine=try?Coroutine.current(),
72-
let completion= scope.add(coroutine.cancel)else{return}
72+
let completion= scope?.add(coroutine.cancel)else{return}
7373
try?task()
7474
completion()
7575
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp