Skip to content

Commit

Permalink
Merge pull request #34 from folio-sec/memory-leak
Browse files Browse the repository at this point in the history
Fix memory leak
  • Loading branch information
kishikawakatsumi authored Jul 25, 2020
2 parents 93de567 + 28913f3 commit 8ae88ab
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "pointfreeco/swift-snapshot-testing" "1.1.0"
github "pointfreeco/swift-snapshot-testing" "1.8.1"
2 changes: 1 addition & 1 deletion Configurations/ImagePipelineTests.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CODE_SIGN_STYLE = Automatic
DEVELOPMENT_TEAM = 27AEDK3C9F
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR)/Carthage/Build/iOS
INFOPLIST_FILE = Tests/$(TARGET_NAME)/Info.plist
IPHONEOS_DEPLOYMENT_TARGET = 10.0
IPHONEOS_DEPLOYMENT_TARGET = 11.0
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks
PRODUCT_BUNDLE_IDENTIFIER = com.folio-sec.$(TARGET_NAME)
PRODUCT_NAME = $(TARGET_NAME)
Expand Down
9 changes: 3 additions & 6 deletions Sources/ImagePipeline/Fetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,19 @@ private class TaskExecutor {

func push(_ task: DownloadTask) {
if let index = tasks.firstIndex(of: task) {
tasks.remove(at: index)
tasks.remove(at: index).sessionTask.cancel()
}
tasks.append(task)
startPendingTasks()
}

func removeTask(for url: URL) {
runningTasks[url] = nil
runningTasks.removeValue(forKey: url)?.sessionTask.cancel()
startPendingTasks()
}

func cancel(for url: URL) {
if let task = runningTasks[url] {
task.sessionTask.cancel()
runningTasks[url] = nil
}
runningTasks.removeValue(forKey: url)?.sessionTask.cancel()
}

func cancelAll() {
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
export NSUnbufferedIO=YES
swift build -v -Xswiftc "-sdk" -Xswiftc "$(xcrun --sdk iphonesimulator --show-sdk-path)" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios13.0-simulator"
carthage bootstrap --platform ios --no-use-binaries
xcodebuild build-for-testing -project ImagePipeline.xcodeproj -scheme ImagePipeline -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11 Pro,OS=13.3'
xcodebuild test-without-building -project ImagePipeline.xcodeproj -scheme ImagePipeline -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11 Pro,OS=13.3'
xcodebuild build-for-testing -project ImagePipeline.xcodeproj -scheme ImagePipeline -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11 Pro,OS=13.6'
xcodebuild test-without-building -project ImagePipeline.xcodeproj -scheme ImagePipeline -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11 Pro,OS=13.6'
displayName: 'Tests'

0 comments on commit 8ae88ab

Please sign in to comment.