From 4ed494f4ad37315fc2d403feb2786a95636fc07c Mon Sep 17 00:00:00 2001 From: Mate Barany Date: Fri, 19 Jul 2024 13:05:41 +0200 Subject: [PATCH] Use QscopedValueRollback in startRequestSynchronously() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.7 6.5 Change-Id: I18c7b9e2f4f8093393176eedfb3ed5a2604bf51b Reviewed-by: MÃ¥rten Nordheim (cherry picked from commit 41f6338a7d8b848008d7906016bda498c13928e1) Reviewed-by: Qt Cherry-pick Bot --- src/network/access/qhttpthreaddelegate.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 #include #include +#include #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 guard(this->synchronousRequestLoop, &synchronousRequestLoop); // Worst case timeout QTimer::singleShot(30*1000, this, SLOT(abortRequest()));