1
1
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:
Tae Won Ha 2019-03-10 18:46:34 +01:00
parent a168e24eca
commit 42a40f97de
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
3 changed files with 18 additions and 2 deletions

View File

@ -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()

View File

@ -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,

View File

@ -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: