Skip to content

Commit

Permalink
Merge pull request #287 from SDWebImage/bugfix/remove_player_dealloc_…
Browse files Browse the repository at this point in the history
…publisher

Try to workaround the #281 when imagePlayer stopPlaying trigger the Combine Publisher during deallocating
  • Loading branch information
dreampiggy committed Dec 13, 2023
2 parents aee64ef + ce1f95b commit af858cc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,46 +54,33 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/SDWebImageSwiftUIDemo-watchOS WatchKit App">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32E529362348A0DD00EA46FF"
BuildableName = "SDWebImageSwiftUIDemo-watchOS WatchKit App.app"
BlueprintName = "SDWebImageSwiftUIDemo-watchOS WatchKit App"
ReferencedContainer = "container:SDWebImageSwiftUI.xcodeproj">
</BuildableReference>
</RemoteRunnable>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/SDWebImageSwiftUIDemo-watchOS WatchKit App">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32E529362348A0DD00EA46FF"
BuildableName = "SDWebImageSwiftUIDemo-watchOS WatchKit App.app"
BlueprintName = "SDWebImageSwiftUIDemo-watchOS WatchKit App"
ReferencedContainer = "container:SDWebImageSwiftUI.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32E529362348A0DD00EA46FF"
BuildableName = "SDWebImageSwiftUIDemo-watchOS WatchKit App.app"
BlueprintName = "SDWebImageSwiftUIDemo-watchOS WatchKit App"
ReferencedContainer = "container:SDWebImageSwiftUI.xcodeproj">
</BuildableReference>
</MacroExpansion>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
1 change: 1 addition & 0 deletions SDWebImageSwiftUI/Classes/ImageManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import SwiftUI
import Combine
import SDWebImage

/// A Image observable object for handle image load process. This drive the Source of Truth for image loading status.
Expand Down
5 changes: 1 addition & 4 deletions SDWebImageSwiftUI/Classes/ImagePlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import SwiftUI
import Combine
import SDWebImage

/// A Image observable object for handle aniamted image playback. This is used to avoid `@State` update may capture the View struct type and cause memory leak.
Expand All @@ -29,10 +30,6 @@ public final class ImagePlayer : ObservableObject {
/// Animation playback mode
public var playbackMode: SDAnimatedImagePlaybackMode = .normal

deinit {
player?.stopPlaying()
}

/// Current playing frame image
@Published public var currentFrame: PlatformImage?

Expand Down
1 change: 1 addition & 0 deletions SDWebImageSwiftUI/Classes/Indicator/Indicator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import Foundation
import Combine
import SwiftUI

/// A type to build the indicator
Expand Down

0 comments on commit af858cc

Please sign in to comment.