1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-09-11 17:15:34 +03:00

Fix memory leak

This commit is contained in:
Tae Won Ha 2023-12-22 23:27:35 +01:00
parent 26028751d7
commit c4e4c9b688
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
2 changed files with 9 additions and 6 deletions

View File

@ -24,9 +24,9 @@ class Document: NSDocument, NSWindowDelegate {
self.nvimView
.events
.observe(on: MainScheduler.instance)
.subscribe(onNext: { event in
.subscribe(onNext: { [weak self] event in
switch event {
case .neoVimStopped: self.close()
case .neoVimStopped: self?.close()
default: break
}
})

View File

@ -70,8 +70,11 @@ extension MainWindow {
func bufferListChanged() {
self.neoVimView
.allBuffers()
.subscribe(onSuccess: { buffers in
self.emit(self.uuidAction(for: .setBufferList(buffers.filter(\.isListed))))
.subscribe(onSuccess: { [weak self] buffers in
guard let action = self?.uuidAction(for: .setBufferList(buffers.filter(\.isListed))) else {
return
}
self?.emit(action)
})
.disposed(by: self.disposeBag)
}
@ -87,8 +90,8 @@ extension MainWindow {
func tabChanged() {
self.neoVimView
.currentBuffer()
.subscribe(onSuccess: {
self.newCurrentBuffer($0)
.subscribe(onSuccess: { [weak self] in
self?.newCurrentBuffer($0)
})
.disposed(by: self.disposeBag)
}