Open rlaferla opened 7 years ago
Do you have more context, code sample, etc?
Sorry, I've been out of the country for the past week. Let me see what I can find.
OK, thanks very much 原始邮件 发件人:Robert La Ferlanotifications@github.com 收件人:MailCore/mailcore2mailcore2@noreply.github.com 发送时间:2016年11月28日(周一) 18:31 主题:Re: [MailCore/mailcore2] MCIMAPAsyncConnection EXC_BAD_ACCESS (#1572)
Sorry, I've been out of the country for the past week. Let me see what I can find. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Using the latest Mailcore branch, this crash has been occurring in afterMain(). I added a check for a nil session and it seems to have gone away. Here's my fix:
void IMAPOperation::afterMain()
{
if (mSession->session() != nil && mSession->session()->isAutomaticConfigurationDone()) {
mSession->owner()->automaticConfigurationDone(mSession->session());
mSession->session()->resetAutomaticConfigurationDone();
}
}
The above code does not fix the issue. I am trying this instead. Is my fix correct to not execute afterMain() if the operation was cancelled? How about the retain before the callback?
void OperationQueue::callbackOnMainThread(Operation * op)
{
// Move call to afterMain() to after check for cancelled
if (op->isCancelled())
return;
op->afterMain();
if (op->callback() != NULL) {
op->callback()->operationFinished(op);
}
}
then in OperationQueue::runOperations()
if (!op->isCancelled()) {
retain(); // Added call to retain to prevent extra release
performOnCallbackThread(op, (Object::Method) &OperationQueue::callbackOnMainThread, op, true);
}
In the void Object::performMethodOnDispatchQueueAfterDelay(Method method, void context, void targetDispatchQueue, double delay),when run dupCancelableBlock(false) will crash on
dispatch_queue_t IMAPAsyncConnection::dispatchQueue() { return mQueue->dispatchQueue(); //EXC_BAD_ACCESS }
it happend more than 5 times crash here.
I'm seeing this spurious crash on iOS: