mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
avoid array mutated while being enumerated
This commit is contained in:
parent
01bb34843d
commit
03ee02ded8
3 changed files with 10 additions and 2 deletions
|
|
@ -1387,7 +1387,8 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat
|
|||
// rare case, remove duplicated fileTransferDelegates to avoid crash
|
||||
[_fileTransferDelegates setArray:[[NSSet setWithArray:_fileTransferDelegates] allObjects]];
|
||||
for (FileTransferDelegate *ftd in _fileTransferDelegates) {
|
||||
[ftd stopAndDestroy];
|
||||
// Not remove here, avoid array mutated while being enumerated
|
||||
[ftd stopAndDestroyAndRemove:FALSE];
|
||||
}
|
||||
[_fileTransferDelegates removeAllObjects];
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
- (void)cancel;
|
||||
- (BOOL)download:(LinphoneChatMessage *)message;
|
||||
- (void)stopAndDestroy;
|
||||
- (void)stopAndDestroyAndRemove:(BOOL)remove;
|
||||
+ (FileTransferDelegate *)messageDelegate:(LinphoneChatMessage *)message;
|
||||
|
||||
@property() LinphoneChatMessage *message;
|
||||
|
|
|
|||
|
|
@ -173,7 +173,13 @@ static void file_transfer_progress_indication_send(LinphoneChatMessage *message,
|
|||
}
|
||||
|
||||
- (void)stopAndDestroy {
|
||||
[[LinphoneManager.instance fileTransferDelegates] removeObject:self];
|
||||
[self stopAndDestroyAndRemove:TRUE];
|
||||
}
|
||||
|
||||
- (void)stopAndDestroyAndRemove:(BOOL)remove {
|
||||
if (remove)
|
||||
[[LinphoneManager.instance fileTransferDelegates] removeObject:self];
|
||||
|
||||
if (_message != NULL) {
|
||||
LinphoneChatMessage *msg = _message;
|
||||
_message = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue