mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +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
|
// rare case, remove duplicated fileTransferDelegates to avoid crash
|
||||||
[_fileTransferDelegates setArray:[[NSSet setWithArray:_fileTransferDelegates] allObjects]];
|
[_fileTransferDelegates setArray:[[NSSet setWithArray:_fileTransferDelegates] allObjects]];
|
||||||
for (FileTransferDelegate *ftd in _fileTransferDelegates) {
|
for (FileTransferDelegate *ftd in _fileTransferDelegates) {
|
||||||
[ftd stopAndDestroy];
|
// Not remove here, avoid array mutated while being enumerated
|
||||||
|
[ftd stopAndDestroyAndRemove:FALSE];
|
||||||
}
|
}
|
||||||
[_fileTransferDelegates removeAllObjects];
|
[_fileTransferDelegates removeAllObjects];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
- (void)cancel;
|
- (void)cancel;
|
||||||
- (BOOL)download:(LinphoneChatMessage *)message;
|
- (BOOL)download:(LinphoneChatMessage *)message;
|
||||||
- (void)stopAndDestroy;
|
- (void)stopAndDestroy;
|
||||||
|
- (void)stopAndDestroyAndRemove:(BOOL)remove;
|
||||||
+ (FileTransferDelegate *)messageDelegate:(LinphoneChatMessage *)message;
|
+ (FileTransferDelegate *)messageDelegate:(LinphoneChatMessage *)message;
|
||||||
|
|
||||||
@property() LinphoneChatMessage *message;
|
@property() LinphoneChatMessage *message;
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,13 @@ static void file_transfer_progress_indication_send(LinphoneChatMessage *message,
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)stopAndDestroy {
|
- (void)stopAndDestroy {
|
||||||
[[LinphoneManager.instance fileTransferDelegates] removeObject:self];
|
[self stopAndDestroyAndRemove:TRUE];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)stopAndDestroyAndRemove:(BOOL)remove {
|
||||||
|
if (remove)
|
||||||
|
[[LinphoneManager.instance fileTransferDelegates] removeObject:self];
|
||||||
|
|
||||||
if (_message != NULL) {
|
if (_message != NULL) {
|
||||||
LinphoneChatMessage *msg = _message;
|
LinphoneChatMessage *msg = _message;
|
||||||
_message = NULL;
|
_message = NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue