Skip to content

Commit

Permalink
fix memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
msfrms committed Aug 14, 2019
1 parent 3596118 commit ba5a5f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Source/Future.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ final public class Future<R> {

public init(queue: DispatchQueue, complete: @escaping Task) {
self.queue = queue
queue.async {
queue.async { [weak self] in
complete { value in
self.value = value
self.callbacks.forEach { $0(value) }
self.detach()
self?.value = value
self?.callbacks.forEach { $0(value) }
self?.detach()
}
}
}
Expand Down

0 comments on commit ba5a5f4

Please sign in to comment.