I create an QThread using moveToThread(), where I use a QTimer to pull stuff from network instantly.

In construct I call
Qt Code:
  1. _http = new HttpAdapter(this);
To copy to clipboard, switch view to plain text mode 

and in periodically function run
Qt Code:
  1. _http->Download();
To copy to clipboard, switch view to plain text mode 

In httpAdapter header
Qt Code:
  1. QNetworkReply* _reply;
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void HttpAdapter::Download() {
  2.  
  3. QString url;
  4. url += Server::get()->GetBaseUrl();
  5. url += "get.xml";
  6.  
  7. QNetworkAccessManager * http = new QNetworkAccessManager;
  8.  
  9. QNetworkRequest request;
  10. request.setHeader(QNetworkRequest::ContentLengthHeader, "0");
  11. request.setUrl(QUrl::fromUserInput(url));
  12.  
  13. _reply = http->get(request);
  14.  
  15. connect(_reply,SIGNAL(finished()),this, SLOT(Finished()));
  16. connect(_reply,SIGNAL(readyRead()),this, SLOT(ReadyData()));
  17. connect(_reply,SIGNAL(error(QNetworkReply::NetworkError)),this, SLOT(foldersError(QNetworkReply::NetworkError)));
  18. connect(_reply,SIGNAL(sslErrors ( const QList<QSslError> & )),this, SLOT(SslErrors( const QList<QSslError> &)));
  19. }
To copy to clipboard, switch view to plain text mode 

The on finish...

Qt Code:
  1. void HttpAdapter::Finished() {
  2. DEBUGME_MSG("finished");
  3.  
  4. int httpCode = _reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt();
  5. if (httpCode != 200) {
  6. INFO_DEBUGME("HTTP CODE " + QString::number(httpCode));
  7. return;
  8. }
  9.  
  10. if (!_reply->isFinished()) {
  11. return;
  12. }
  13.  
  14. if (!_reply->isReadable()) {
  15. return;
  16. }
  17.  
  18. _data = _reply->readAll();
  19. _reply->deleteLater();
  20.  
  21. if (_data.isEmpty()) {
  22. INFO_DEBUGME("DATA EMPTY");
  23. return;
  24. }
  25.  
  26. //success
  27. }
To copy to clipboard, switch view to plain text mode 

And THE CRASH IS ON
Qt Code:
  1. _data = _reply->readAll();
To copy to clipboard, switch view to plain text mode 

The crash happen randomly, I would say in 5% of the calls, Any idea why ??