Skip to content

Commit af858cc

Browse files
authored
Merge pull request #287 from SDWebImage/bugfix/remove_player_dealloc_publisher
Try to workaround the #281 when imagePlayer stopPlaying trigger the Combine Publisher during deallocating
2 parents aee64ef + ce1f95b commit af858cc

File tree

4 files changed

+9
-23
lines changed

4 files changed

+9
-23
lines changed

Example/SDWebImageSwiftUI.xcodeproj/xcshareddata/xcschemes/SDWebImageSwiftUIDemo-watchOS WatchKit App.xcscheme

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,46 +54,33 @@
5454
debugDocumentVersioning = "YES"
5555
debugServiceExtension = "internal"
5656
allowLocationSimulation = "YES">
57-
<RemoteRunnable
58-
runnableDebuggingMode = "2"
59-
BundleIdentifier = "com.apple.Carousel"
60-
RemotePath = "/SDWebImageSwiftUIDemo-watchOS WatchKit App">
57+
<BuildableProductRunnable
58+
runnableDebuggingMode = "0">
6159
<BuildableReference
6260
BuildableIdentifier = "primary"
6361
BlueprintIdentifier = "32E529362348A0DD00EA46FF"
6462
BuildableName = "SDWebImageSwiftUIDemo-watchOS WatchKit App.app"
6563
BlueprintName = "SDWebImageSwiftUIDemo-watchOS WatchKit App"
6664
ReferencedContainer = "container:SDWebImageSwiftUI.xcodeproj">
6765
</BuildableReference>
68-
</RemoteRunnable>
66+
</BuildableProductRunnable>
6967
</LaunchAction>
7068
<ProfileAction
7169
buildConfiguration = "Release"
7270
shouldUseLaunchSchemeArgsEnv = "YES"
7371
savedToolIdentifier = ""
7472
useCustomWorkingDirectory = "NO"
7573
debugDocumentVersioning = "YES">
76-
<RemoteRunnable
77-
runnableDebuggingMode = "2"
78-
BundleIdentifier = "com.apple.Carousel"
79-
RemotePath = "/SDWebImageSwiftUIDemo-watchOS WatchKit App">
74+
<BuildableProductRunnable
75+
runnableDebuggingMode = "0">
8076
<BuildableReference
8177
BuildableIdentifier = "primary"
8278
BlueprintIdentifier = "32E529362348A0DD00EA46FF"
8379
BuildableName = "SDWebImageSwiftUIDemo-watchOS WatchKit App.app"
8480
BlueprintName = "SDWebImageSwiftUIDemo-watchOS WatchKit App"
8581
ReferencedContainer = "container:SDWebImageSwiftUI.xcodeproj">
8682
</BuildableReference>
87-
</RemoteRunnable>
88-
<MacroExpansion>
89-
<BuildableReference
90-
BuildableIdentifier = "primary"
91-
BlueprintIdentifier = "32E529362348A0DD00EA46FF"
92-
BuildableName = "SDWebImageSwiftUIDemo-watchOS WatchKit App.app"
93-
BlueprintName = "SDWebImageSwiftUIDemo-watchOS WatchKit App"
94-
ReferencedContainer = "container:SDWebImageSwiftUI.xcodeproj">
95-
</BuildableReference>
96-
</MacroExpansion>
83+
</BuildableProductRunnable>
9784
</ProfileAction>
9885
<AnalyzeAction
9986
buildConfiguration = "Debug">

SDWebImageSwiftUI/Classes/ImageManager.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
import SwiftUI
10+
import Combine
1011
import SDWebImage
1112

1213
/// A Image observable object for handle image load process. This drive the Source of Truth for image loading status.

SDWebImageSwiftUI/Classes/ImagePlayer.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
import SwiftUI
10+
import Combine
1011
import SDWebImage
1112

1213
/// 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.
@@ -29,10 +30,6 @@ public final class ImagePlayer : ObservableObject {
2930
/// Animation playback mode
3031
public var playbackMode: SDAnimatedImagePlaybackMode = .normal
3132

32-
deinit {
33-
player?.stopPlaying()
34-
}
35-
3633
/// Current playing frame image
3734
@Published public var currentFrame: PlatformImage?
3835

SDWebImageSwiftUI/Classes/Indicator/Indicator.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
import Foundation
10+
import Combine
1011
import SwiftUI
1112

1213
/// A type to build the indicator

0 commit comments

Comments
 (0)