summaryrefslogtreecommitdiff
path: root/src/plugins/cpaster/protocol.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-08-20 17:31:37 +0200
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-08-20 17:31:37 +0200
commit8a91d7f68cd0492be5bd9d141dbc8a39e0750d5b (patch)
tree4103f257670a05f8c566645cdae26476e618956f /src/plugins/cpaster/protocol.cpp
parent94babbd9ca5eaf22817a41e2df29f2fc8dcad352 (diff)
downloadqt-creator-8a91d7f68cd0492be5bd9d141dbc8a39e0750d5b.tar.gz
CodePaster: Do not leak the test reply, do not show empty message.
... on canceling.
Diffstat (limited to 'src/plugins/cpaster/protocol.cpp')
-rw-r--r--src/plugins/cpaster/protocol.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/cpaster/protocol.cpp b/src/plugins/cpaster/protocol.cpp
index 00ea7bca15..615b466628 100644
--- a/src/plugins/cpaster/protocol.cpp
+++ b/src/plugins/cpaster/protocol.cpp
@@ -128,7 +128,8 @@ bool Protocol::ensureConfiguration(Protocol *p, QWidget *parent)
ok = true;
break;
}
- if (!showConfigurationError(p, errorMessage, parent))
+ // Cancel returns empty error message.
+ if (errorMessage.isEmpty() || !showConfigurationError(p, errorMessage, parent))
break;
}
return ok;
@@ -209,19 +210,20 @@ bool NetworkProtocol::httpStatus(QString url, QString *errorMessage)
url.prepend(httpPrefix);
url.append(QLatin1Char('/'));
}
- QNetworkReply *reply = httpGet(url);
+ QScopedPointer<QNetworkReply> reply(httpGet(url));
QMessageBox box(QMessageBox::Information,
tr("Checking connection"),
tr("Connecting to %1...").arg(url),
QMessageBox::Cancel,
Core::ICore::instance()->mainWindow());
- connect(reply, SIGNAL(finished()), &box, SLOT(close()));
+ connect(reply.data(), SIGNAL(finished()), &box, SLOT(close()));
QApplication::setOverrideCursor(Qt::WaitCursor);
box.exec();
QApplication::restoreOverrideCursor();
// User canceled, discard and be happy.
if (!reply->isFinished()) {
- connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater()));
+ QNetworkReply *replyPtr = reply.take();
+ connect(replyPtr, SIGNAL(finished()), replyPtr, SLOT(deleteLater()));
return false;
}
// Passed