mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-23 19:21:53 +03:00
Fix a memory leak
- NSTreeController's contentArray binding to FileOutlineView created a retain cycle.
This commit is contained in:
parent
a168e24eca
commit
42a40f97de
@ -64,6 +64,10 @@ class FileBrowser: NSView,
|
||||
.disposed(by: self.disposeBag)
|
||||
}
|
||||
|
||||
deinit {
|
||||
self.fileView.unbindTreeController()
|
||||
}
|
||||
|
||||
private let emit: (UuidAction<Action>) -> Void
|
||||
private let disposeBag = DisposeBag()
|
||||
|
||||
|
@ -163,6 +163,10 @@ class FileOutlineView: NSOutlineView,
|
||||
}
|
||||
}
|
||||
|
||||
func unbindTreeController() {
|
||||
self.treeController.unbind(.contentArray)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
@ -215,7 +219,11 @@ class FileOutlineView: NSOutlineView,
|
||||
NSSortDescriptor(key: "isLeaf", ascending: true), // Folders first,
|
||||
NSSortDescriptor(key: "displayName", ascending: true) // then, name
|
||||
]
|
||||
|
||||
// The following will create a retain cycle. The superview *must* unbind
|
||||
// in deinit. See deinit of FileBrowser
|
||||
self.treeController.bind(.contentArray, to: self, withKeyPath: "content")
|
||||
|
||||
self.bind(.content, to: self.treeController, withKeyPath: "arrangedObjects")
|
||||
self.bind(.selectionIndexPaths,
|
||||
to: self.treeController,
|
||||
|
@ -2,11 +2,15 @@
|
||||
|
||||
* ...
|
||||
|
||||
# 0.26.2-???
|
||||
# 0.26.3-???
|
||||
|
||||
* Fix a memory leak.
|
||||
|
||||
# 0.26.2-305
|
||||
|
||||
* GH-425: Bind http server to localhost
|
||||
|
||||
# 0.26.1-???
|
||||
# 0.26.1-304
|
||||
|
||||
* Fix broken "Navigate to the current buffer" of the file browser
|
||||
* Dependencies updates:
|
||||
|
Loading…
Reference in New Issue
Block a user