summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesus Fernandez <jesus.fernandez@qt.io>2018-01-18 18:22:46 +0100
committerJesus Fernandez <Jesus.Fernandez@qt.io>2018-02-13 12:30:51 +0000
commit40c00e2df2130d153968e7ddedfedc654fc55970 (patch)
treeb5955dbd6998e11caaceceaf2f22b62ea824a866
parent1a251f8fcf2749604dc15a4d7d2ceb636daac61c (diff)
Fix a leak
The object was leaking memory because QAbstractOAuth::setReplyHandler() is not taking the ownership of the replyHandler. Change-Id: I05e6ba9a7781c062d7c860908306680486de49bd Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--tests/auto/oauth2/tst_oauth2.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/auto/oauth2/tst_oauth2.cpp b/tests/auto/oauth2/tst_oauth2.cpp
index 826be06..4b591f0 100644
--- a/tests/auto/oauth2/tst_oauth2.cpp
+++ b/tests/auto/oauth2/tst_oauth2.cpp
@@ -80,11 +80,11 @@ void tst_OAuth2::getToken()
QOAuth2AuthorizationCodeFlow oauth2;
oauth2.setAuthorizationUrl(webServer.url(QLatin1String("authorization")));
oauth2.setAccessTokenUrl(webServer.url(QLatin1String("accessToken")));
- auto replyHandler = new ReplyHandler;
- oauth2.setReplyHandler(replyHandler);
+ ReplyHandler replyHandler;
+ oauth2.setReplyHandler(&replyHandler);
connect(&oauth2, &QOAuth2AuthorizationCodeFlow::authorizeWithBrowser, [&](const QUrl &url) {
const QUrlQuery query(url.query());
- replyHandler->emitCallbackReceived(QVariantMap {
+ replyHandler.emitCallbackReceived(QVariantMap {
{ QLatin1String("code"), QLatin1String("test") },
{ QLatin1String("state"),
query.queryItemValue(QLatin1String("state")) }