summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMate Barany <[email protected]>2024-07-19 13:05:41 +0200
committerMate Barany <[email protected]>2024-07-26 18:43:40 +0200
commit41f6338a7d8b848008d7906016bda498c13928e1 (patch)
treebebb9171ee6a68ecf8312935d83785090fdfe774
parent5970edaeb9b8eac42c8fa07f6962770977a32042 (diff)
Use QscopedValueRollback in startRequestSynchronously()
Use QscopedValueRollback in QHttpThreadDelegate::startRequestSynchronously to handle a "Potentially leaking reference/pointer to local variable" warning. Found by an Axivion scan. Task-number: QTBUG-125026 Pick-to: 6.8 6.7 6.5 Change-Id: I18c7b9e2f4f8093393176eedfb3ed5a2604bf51b Reviewed-by: MÃ¥rten Nordheim <[email protected]>
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index 4e5cf05aef4..1e11c9cd96a 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -9,6 +9,7 @@
#include <QAuthenticator>
#include <QEventLoop>
#include <QCryptographicHash>
+#include <QtCore/qscopedvaluerollback.h>
#include "private/qhttpnetworkreply_p.h"
#include "private/qnetworkaccesscache_p.h"
@@ -215,7 +216,7 @@ void QHttpThreadDelegate::startRequestSynchronously()
synchronous = true;
QEventLoop synchronousRequestLoop;
- this->synchronousRequestLoop = &synchronousRequestLoop;
+ QScopedValueRollback<QEventLoop*> guard(this->synchronousRequestLoop, &synchronousRequestLoop);
// Worst case timeout
QTimer::singleShot(30*1000, this, SLOT(abortRequest()));