Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when use GPRS to send a mail ,error:kSKPSMTPErrorConnectionInterrupted.app crash #4

Open
allanpk716 opened this issue May 31, 2012 · 3 comments
Assignees

Comments

@allanpk716
Copy link

when use GPRS to send a mail ,some time it will out this error:kSKPSMTPErrorConnectionInterrupted.

"The connection to the server was interrupted.", @"server connection interrupted error description"

then app crash . but other error won't have this problem.

@allanpk716
Copy link
Author

So i find the solution.

in SKPSMTPMessage.m

delete this two lines.

    case NSStreamEventEndEncountered:
    {
        [self stopWatchdog];
        [stream close];
        [stream removeFromRunLoop:[NSRunLoop currentRunLoop]
                          forMode:NSDefaultRunLoopMode];
        [stream release];//delete!
        stream = nil; //delete!

        if (sendState != kSKPSMTPMessageSent)
        {
            [delegate messageFailed:self 
                              error:[NSError errorWithDomain:@"SKPSMTPMessageError" 
                                                        code:kSKPSMTPErrorConnectionInterrupted 
                                                    userInfo:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"The connection to the server was interrupted.", @"server connection interrupted error description"),NSLocalizedDescriptionKey,
                                                              NSLocalizedString(@"Try sending your message again later.", @"server generic error recovery"),NSLocalizedRecoverySuggestionErrorKey,nil]]];

        }

        break;
    }

because in the - (void)dealloc

[inputStream release];
inputStream = nil;

it will release twice,so app will crash.

@jetseven
Copy link
Owner

jetseven commented Jun 2, 2012

This does look suspicious, but are you sure this doesn't cause a memory leak? If stream is set to nil, the release in dealloc should be safe.

@allanpk716
Copy link
Author

ye,it sounds crazy.but in the actual test,it hard to get this error,
"The connection to the server was interrupted.", @"server connection interrupted error description"
so ,i just test a few min.and when xcode warn me,then it stop at

  • (void)dealloc

[inputStream release];

as you said,stream is set to nil,but why it crash here?
i'm new,so i only follow the xcode to solve the problem of directly.

@ghost ghost assigned jetseven Jun 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants