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:
parent
b04876185d
commit
859f479a89
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue