mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Fix a memory leak that happened every time you added a feed. Use a weak delegate to avoid a retain cycle.
This commit is contained in:
@@ -11,14 +11,14 @@ import RSParser
|
||||
import RSWeb
|
||||
import RSCore
|
||||
|
||||
public protocol FeedFinderDelegate {
|
||||
public protocol FeedFinderDelegate: class {
|
||||
|
||||
func feedFinder(_: FeedFinder, didFindFeeds: Set<FeedSpecifier>)
|
||||
}
|
||||
|
||||
public class FeedFinder {
|
||||
|
||||
fileprivate let delegate: FeedFinderDelegate
|
||||
fileprivate weak var delegate: FeedFinderDelegate?
|
||||
fileprivate var feedSpecifiers = [String: FeedSpecifier]()
|
||||
fileprivate var didNotifyDelegate = false
|
||||
|
||||
@@ -195,7 +195,7 @@ private extension FeedFinder {
|
||||
func notifyDelegateIfNeeded() {
|
||||
|
||||
if !didNotifyDelegate {
|
||||
delegate.feedFinder(self, didFindFeeds: Set(feedSpecifiers.values))
|
||||
delegate?.feedFinder(self, didFindFeeds: Set(feedSpecifiers.values))
|
||||
didNotifyDelegate = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user