Ensure running unregisterDelegate.dispose() on main thread.#19
Conversation
|
Thanks for your PR @mongris. I already used |
|
@dangthaison91 Unfortunately it's not working. I have upload a simple project to repo this issue: |
There was a problem hiding this comment.
@mongris sorry for delay. I checked your code and commented. Please check it.
| } | ||
| } | ||
|
|
||
| return Disposables.create { [weak object] in |
There was a problem hiding this comment.
How about usingScheduledDisposable ?
let disposable = Disposable.create { /* do something */ }
ScheduledDisposable(scheduler: MainScheduler(), disposable: disposable)| unregisterDelegate.dispose() | ||
| default: | ||
| break | ||
| // ensure running unregisterDelegate.dispose() on main thread |
There was a problem hiding this comment.
I found that following code cause #18
let subscription = self.asObservable()
.observeOn(MainScheduler())
// and more...but following does not cause same problems without your patches.
let subscription = self.asObservable()
.catchError { error in
bindingErrorToInterface(error)
return Observable.empty()
}
// source can never end, otherwise it would release the subscriber, and deallocate the data source
.concat(Observable.never())
.takeUntil(object.rx.deallocated)
.observeOn(MainScheduler()) // <= Move to hereDo you know why ? I want to make code more Rx-like if we can.
|
@fumito-ito Sorry for my delay. |
|
@fumito-ito I found another solution: The problem is |
|
@mongris Great ! your second solution looks better than others. could you update your PR to wrap |
|
Thanks @mongris and @fumito-ito |
|
Thanks a lot for contributing @mongris! I've invited you to join the Generated by 🚫 dangerJS |
Fixed issue #18