File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -166,8 +166,11 @@ public void Cancel()
166166 if ( ImageLoader . settings . debugLevel <= DebugLevel . Log && ! muteLogs )
167167 Debug . Log ( $ "[ImageLoader] Cancel: { Url } ") ;
168168 Status = FutureStatus . Canceled ;
169- cts . Cancel ( ) ;
170- OnCanceled ? . Invoke ( ) ;
169+ if ( ! cts . IsCancellationRequested )
170+ {
171+ cts . Cancel ( ) ;
172+ OnCanceled ? . Invoke ( ) ;
173+ }
171174 Clear ( ) ;
172175 }
173176
@@ -176,17 +179,23 @@ public void Cancel()
176179 /// </summary>
177180 public void Dispose ( )
178181 {
179- Clear ( ) ;
182+ if ( Status == FutureStatus . Disposed ) return ;
183+ if ( ! cts . IsCancellationRequested )
184+ {
185+ cts . Cancel ( ) ;
186+ OnCanceled ? . Invoke ( ) ;
187+ }
180188 Status = FutureStatus . Disposed ;
181189 OnDispose ? . Invoke ( this ) ;
182190 OnDispose = null ;
191+ Clear ( ) ;
183192
184193 if ( value is IDisposable disposable )
185194 disposable ? . Dispose ( ) ;
186195
187196 value = default ;
188197 exception = default ;
189- cts . Cancel ( ) ;
198+
190199 cts . Dispose ( ) ;
191200 }
192201
Original file line number Diff line number Diff line change 55 "name" : " Ivan Murzak" ,
66 "url" : " https://github.com/IvanMurzak"
77 },
8- "version" : " 5.3.2 " ,
8+ "version" : " 5.3.3 " ,
99 "unity" : " 2019.2" ,
1010 "description" : " Asynchronous image loading from remote or local destination. It has two layers of configurable Memory and Disk cache systems." ,
1111 "dependencies" : {
You can’t perform that action at this time.
0 commit comments