Hello,
I'm building a network module for an application, I need to be able to send requests from the main application thread and also from a RefreshThread.
I have a HTTPRequestHandler responsible for sending requests and receiving responses in which I connect two signals:
void HTTPRequestHandler::sendNextRequest()
{
if(queue->size() <= 0) { return; }
request = queue->dequeue();
reply = manager->get(*request->getRequest());
qDebug() << "Request started : " << request->getRequest()->url().toString();
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(requestFailed()));
connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
}
void HTTPRequestHandler::sendNextRequest()
{
if(queue->size() <= 0) { return; }
request = queue->dequeue();
reply = manager->get(*request->getRequest());
qDebug() << "Request started : " << request->getRequest()->url().toString();
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(requestFailed()));
connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
}
To copy to clipboard, switch view to plain text mode
Everything works fine when the HTTPRequestHandler is executed in the main application thread but when it is executed in the RefreshThread, the request get sent but my requestFinished() slot never gets called.
I can't figure out why this should happen since my signals and slots are in the same class, namely HTTPRequestHandler and since I'm not sending signals between different threads.
Can someone help me figure out what's happening?
Thanks in advance!
Bookmarks