1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-29 00:34:26 +03:00

Do not unown self in subscribe of the main window state source

- we explicitly terminate the sequence when we close the window
This commit is contained in:
Tae Won Ha 2017-05-15 19:18:51 +02:00
parent 0b47107188
commit 494f3625d1
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
4 changed files with 6 additions and 6 deletions

View File

@ -51,7 +51,7 @@ class FileBrowser: NSView,
source
.observeOn(MainScheduler.instance)
.subscribe(onNext: { [unowned self] state in
.subscribe(onNext: { state in
if self.cwd != state.cwd {
self.cwd = state.cwd
self.innerCustomToolbar.goToParentButton.isEnabled = state.cwd.path != "/"

View File

@ -46,7 +46,7 @@ class FileOutlineView: NSOutlineView,
latest: true,
scheduler: SerialDispatchQueueScheduler(qos: .background))
.observeOn(MainScheduler.instance)
.subscribe(onNext: { [unowned self] state in
.subscribe(onNext: { state in
self.lastFileSystemUpdateMark = state.lastFileSystemUpdate.mark
self.update(state.lastFileSystemUpdate.payload)
})
@ -54,7 +54,7 @@ class FileOutlineView: NSOutlineView,
source
.observeOn(MainScheduler.instance)
.subscribe(onNext: { [unowned self] state in
.subscribe(onNext: { state in
if state.viewToBeFocused != nil, case .fileBrowser = state.viewToBeFocused! {
self.beFirstResponder()
}

View File

@ -170,7 +170,7 @@ class MainWindow: NSObject,
source
.observeOn(MainScheduler.instance)
.subscribe(
onNext: { [unowned self] state in
onNext: { state in
if self.isClosing {
return
}

View File

@ -80,7 +80,7 @@ class PreviewTool: NSView, UiComponent, WKNavigationDelegate {
source
.observeOn(MainScheduler.instance)
.subscribe(onNext: { [unowned self] state in
.subscribe(onNext: { state in
if state.viewToBeFocused != nil, case .preview = state.viewToBeFocused! {
self.beFirstResponder()
}
@ -107,7 +107,7 @@ class PreviewTool: NSView, UiComponent, WKNavigationDelegate {
self.lastUpdateDate = state.preview.updateDate
self.webview.load(URLRequest(url: serverUrl))
}, onCompleted: { [unowned self] in
}, onCompleted: {
// We have to do the following to avoid a crash... Dunno why... -_-
self.webviewMessageHandler.subject.onCompleted()
self.webview.navigationDelegate = nil