simple-mail icon indicating copy to clipboard operation
simple-mail copied to clipboard

Async code does nothing

Open joshorenberg opened this issue 3 years ago • 3 comments

I am running Qt Created based on Qt 5.15.2. I borrowed the async code from the example and of course catered it to my situation but nothing happens with no error messages. The following code produces no output regardless of how long I wait:

SimpleMail::ServerReply *reply = server->sendMail(mimeMessage);
        QObject::connect(reply, &SimpleMail::ServerReply::finished, [reply] {
            qDebug() << "Email finished" << reply->error() << reply->responseText();
            reply->deleteLater();// Don't forget to delete it
        });

The blocking code with the same settings works fine.

Thanks!

joshorenberg avatar Aug 23 '22 03:08 joshorenberg

do you have an event loop running?

dantti avatar Aug 23 '22 15:08 dantti

Hmmm AFAIK yes. But I do have a peculiar setup for this program. See below for main.cpp code (stripped for brevity):

int main(int argc, char *argv[])
{
    //this class is derived from QApplication and is part of Qt Solutions for only running one copy of the program at a time
    QtSingleApplication repSAPass("reppass", argc, argv);
    //this is my main gui thread object that has all my code in it (including the async email code), it is derived from QWidget (perhaps I should change it to QObject or something?)
    Replicator replicator;
    //this is obviously where the program starts
    return repSAPass.exec();
}

Thanks for the help. Hopefully this is something easy.

joshorenberg avatar Aug 23 '22 18:08 joshorenberg

so far it looks fine, probably related to your other bug report

dantti avatar Aug 23 '22 20:08 dantti

Fix was merged

dantti avatar Oct 26 '23 19:10 dantti