Skip to content

Commit ff30ccd

Browse files
macosswiftisaac
authored andcommitted
MtProtoKit: Cancel the backup address lookup when a context is cleaned up
MTContext's cleanup disposed every pending action except the backup address discovery. A context freed while a lookup was in flight (the login screen's network on macOS) hit the DEBUG leaked-disposable assert, and in release the lookup kept running after the context was gone.
1 parent 1dd3e7f commit ff30ccd

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎submodules/MtProtoKit/Sources/MTContext.m‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ - (void)cleanup
397397

398398
NSDictionary *transportSchemeDisposableByDatacenterId = _transportSchemeDisposableByDatacenterId;
399399

400+
id<MTDisposable> backupAddressListDisposable = _backupAddressListDisposable;
401+
_backupAddressListDisposable = nil;
402+
400403
[[MTContext contextQueue] dispatchOnQueue:^
401404
{
402405
for (NSNumber *nDatacenterId in discoverDatacenterAddressActions)
@@ -447,6 +450,8 @@ - (void)cleanup
447450
id<MTDisposable> disposable = transportSchemeDisposableByDatacenterId[nDatacenterId];
448451
[disposable dispose];
449452
}
453+
454+
[backupAddressListDisposable dispose];
450455
}];
451456
}
452457

0 commit comments

Comments
 (0)