[Qt-interest] Troubles with QNetworkAccessManager
Lars Andersson
lars.andersson at galder.se
Wed May 11 08:18:19 CEST 2011
>> I am guessing it has something to do with the fact that
>> QNetworkAccessManager is using asynchronous calls and that the threads that
>> are used to make the asynchronous calls are started without QThread?
> Which Qt version are you using?
>
> Recently, the trolls have updated QNAM to use threads.
>
> http://labs.qt.nokia.com/2011/04/29/threaded-http-inside-qnetworkaccessmanager/
>
> But thats still not in any released version of Qt (CMIIW). Are you
> using QNAM pulled from the repo directly?
I am using Qt Desktop 4.7.3.
>> I am able to reproduce the problem with this minimal application.
>>
>> #include<QtCore/QCoreApplication>
>> #include<QtNetwork/QNetworkAccessManager>
>> #include<QtNetwork/QNetworkRequest>
>> #include<QUrl>
>>
>> int main(int argc, char *argv[])
>> {
>> QCoreApplication a(argc, argv);
>> QNetworkAccessManager networkAccessManager;
>> networkAccessManager.get(QNetworkRequest(QUrl("http://www.google.se")));
>> return a.exec();
>> }
>>
>> Have anyone encountered this problem before?
> Umm...how does this app show the problem? I don't see any slots
> connected to QNAM's signals?
>
> -mandeep
>
This minimal application gives the errors that I mentioned when compiled
and run on my Windows 7 64 bit.
As you point out I don't even need to connect any signals to get the
error, it's enough to call the get() function in the QNAM.
If I would have connected any slot to the finished signal in the QNAM I
would have noticed that the signal never gets fired,
which I notice in my real application.
Everything works without any problems on Linux, it is very confusing.
Regards,
Lars Andersson
More information about the Qt-interest-old
mailing list