From 4c9d969380f2add1ea9fa5ace28d96d2ed955972 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Tue, 14 Jan 2014 11:00:34 +0100 Subject: [PATCH] fixed issue with http request --- src/core/UBApplicationController.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index 3bcdfb1a..bb93f0cc 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -482,7 +482,7 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess) void UBApplicationController::checkUpdate(QString urlString) { if(mHttp) - delete mHttp; + mHttp->deleteLater(); QUrl url(urlString); mHttp = new QHttp(url.host()); connect(mHttp, SIGNAL(requestFinished(int,bool)), this, SLOT(updateRequestFinished(int,bool))); @@ -503,14 +503,15 @@ void UBApplicationController::updateHeaderReceived(QHttpResponseHeader header) void UBApplicationController::updateRequestFinished(int id, bool error) { if (error){ - qWarning() << "http command id" << id << "return the error: " << mHttp->errorString(); - mHttp->close(); + qWarning() << "http command id" << id << "return an error"; } else{ QString responseString = QString(mHttp->readAll()); qDebug() << responseString; if (!responseString.isEmpty() && responseString.contains("version") && responseString.contains("url")){ mHttp->close(); + mHttp->deleteLater(); + mHttp = 0; downloadJsonFinished(responseString); } }