Skip to content

Commit c0c3261

Browse files
committed
prevent APIRequest deallocation when Observable from rxResult method is being passed somewhere else without keeping strong reference to APIRequest.
1 parent 735b8c5 commit c0c3261

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [0.4.2](https://github.com/MLSDev/TRON/releases/tag/0.4.2)
5+
6+
### Fixed
7+
8+
* Prevent `APIRequest` from being deallocated if rxResult Observable is passed elsewhere without keeping strong reference to `APIRequest` itself.
9+
410
## [0.4.1](https://github.com/MLSDev/TRON/releases/tag/0.4.1)
511

612
### Fixed

Source/RxSwift/Tron+RxSwift.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ extension APIRequest {
3434
- returns: Observable<ModelType>
3535
*/
3636
public func rxResult() -> Observable<Model.ModelType> {
37-
return Observable.create({ [weak self] observer in
38-
let token = self?.performWithSuccess({ result in
37+
return Observable.create({ observer in
38+
let token = self.performWithSuccess({ result in
3939
observer.onNext(result)
4040
observer.onCompleted()
4141
}, failure: { error in
4242
observer.onError(error)
4343
})
4444
return AnonymousDisposable {
45-
token?.cancel()
45+
token.cancel()
4646
}
4747
})
4848
}

TRON.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'TRON'
3-
s.version = '0.4.1'
3+
s.version = '0.4.2'
44
s.license = 'MIT'
55
s.summary = 'Lightweight network abstraction layer, written on top of Alamofire'
66
s.homepage = 'https://github.com/MLSDev/TRON'

0 commit comments

Comments
 (0)