Sending files using QFile in async mode
DavidKelleySCSC opened this issue · comments
When adding a file as a mime part it looks like the QFile is expected to be on the heap to persist beyond the caller lifetime. Okay, so far so good, that is easy to do. So I call it with a fragment like:
QFile* file = new QFile(filePath);
if (!file->exists()) return(false);
SimpleMail::MimeFile* mimeFile = new SimpleMail::MimeFile(file);
pMessage->addPart(mimeFile );
But I cannot find that the SimpleMail::MimeFile object takes ownership or ever calls a delete on the QFile object. Am I missing something? Or, if disposing of the QFile object remains the callers concern, when it is safe to do so? (Say after a return from server->sendMail(*pMessage) )?
And I have really come to appreciate how well designed your Server class is now that we have moved away from the demo1~4 code with its blocking approach.
Your QFile will be deleted here:
https://github.com/cutelyst/simple-mail/blob/master/src/mimepart.cpp#L331
Yes I see it now, did not trace QFile back far enough. Will close.