(Qt 5.3 version) I have a strange situation with the code that I moved from one project to another. Used to work just fine... Here is the code:
void onResult(QNetworkReply* r)
{
QNetworkReply::NetworkError err = r->error(); // no error
bool isfin = r->isFinished(); // returns true;
qint64 bta = r->bytesAvailable(); // returns 988305 (correct size of a file I am trying to download)
r->setReadBufferSize(0); // to set read buffer to be unlimited size (per doc)
ba = r->readAll(); // UNHANDLED EXCEPTION at 0x5D8CA9E8 (msvcr120d.dll), qlist.h line 432
...
}
void onResult(QNetworkReply* r)
{
QNetworkReply::NetworkError err = r->error(); // no error
bool isfin = r->isFinished(); // returns true;
qint64 bta = r->bytesAvailable(); // returns 988305 (correct size of a file I am trying to download)
r->setReadBufferSize(0); // to set read buffer to be unlimited size (per doc)
QByteArray ba(bta+1000,'0');
ba = r->readAll(); // UNHANDLED EXCEPTION at 0x5D8CA9E8 (msvcr120d.dll), qlist.h line 432
...
}
To copy to clipboard, switch view to plain text mode
I am puzzled and will appreciate any advise or comment on what is going on and how to resolve it.
Details:
void onResult is a slot in a thread class:
{
Q_OBJECT
public:
void run() {
_uploadman.reset(new QNetworkAccessManager());
..
connect(_uploadman.get(), SIGNAL(finished(QNetworkReply*)), this, SLOT(onResult(QNetworkReply*)));
_uploadman->get(upload);
exec();
}
private slots:
void onResult(QNetworkReply* r);
..
}
class downloader : public QThread
{
Q_OBJECT
public:
downloadRebate() : QThread() {}
void run() {
_uploadman.reset(new QNetworkAccessManager());
..
connect(_uploadman.get(), SIGNAL(finished(QNetworkReply*)), this, SLOT(onResult(QNetworkReply*)));
_uploadman->get(upload);
exec();
}
private slots:
void onResult(QNetworkReply* r);
..
}
To copy to clipboard, switch view to plain text mode
Bookmarks