From 3a13eb555061329f4b4d6d043d9fa06de3ffc6c3 Mon Sep 17 00:00:00 2001
From: Martin Delille <martin@delille.org>
Date: Sun, 10 Nov 2019 13:48:11 +0100
Subject: [PATCH 1/3] fixup! Simpler timeout with QTimer::singleShot (#4430)

---
 samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp
index 7517e9650ea..fa888b579ec 100644
--- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp
+++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp
@@ -374,6 +374,7 @@ void PFXHttpRequestWorker::on_manager_finished(QNetworkReply *reply) {
             headers.insert(item.first, item.second);
         }
     }
+    disconnect(this, nullptr, nullptr, nullptr);
     reply->deleteLater();
     process_form_response();
     emit on_execution_finished(this);
@@ -383,7 +384,6 @@ void PFXHttpRequestWorker::on_manager_timeout(QNetworkReply *reply) {
     error_type = QNetworkReply::TimeoutError;
     response = "";
     error_str = "Timed out waiting for response";
-    disconnect(manager, nullptr, nullptr, nullptr);
     reply->abort();
     reply->deleteLater();
     emit on_execution_finished(this);
-- 
GitLab


From 561abb476cf4dda854e93635e21f2c418cd83f75 Mon Sep 17 00:00:00 2001
From: Martin Delille <martin@delille.org>
Date: Sun, 10 Nov 2019 14:00:29 +0100
Subject: [PATCH 2/3] Move disconnect again

---
 .../src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache  | 2 +-
 samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache
index ee78bd19562..80ce348f3ff 100644
--- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache
+++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache
@@ -365,7 +365,6 @@ void {{prefix}}HttpRequestWorker::on_manager_finished(QNetworkReply *reply) {
             headers.insert(item.first, item.second);
         }
     }
-    disconnect(this, nullptr, nullptr, nullptr);
     reply->deleteLater();
     process_form_response();
     emit on_execution_finished(this);
@@ -375,6 +374,7 @@ void {{prefix}}HttpRequestWorker::on_manager_timeout(QNetworkReply *reply) {
     error_type = QNetworkReply::TimeoutError;
     response = "";
     error_str = "Timed out waiting for response";
+    disconnect(manager, nullptr, nullptr, nullptr);
     reply->abort();
     reply->deleteLater();
     emit on_execution_finished(this);
diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp
index fa888b579ec..7517e9650ea 100644
--- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp
+++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp
@@ -374,7 +374,6 @@ void PFXHttpRequestWorker::on_manager_finished(QNetworkReply *reply) {
             headers.insert(item.first, item.second);
         }
     }
-    disconnect(this, nullptr, nullptr, nullptr);
     reply->deleteLater();
     process_form_response();
     emit on_execution_finished(this);
@@ -384,6 +383,7 @@ void PFXHttpRequestWorker::on_manager_timeout(QNetworkReply *reply) {
     error_type = QNetworkReply::TimeoutError;
     response = "";
     error_str = "Timed out waiting for response";
+    disconnect(manager, nullptr, nullptr, nullptr);
     reply->abort();
     reply->deleteLater();
     emit on_execution_finished(this);
-- 
GitLab


From 778169fcddf805fa9caff680c7062ad718c0ef5d Mon Sep 17 00:00:00 2001
From: Martin Delille <martin@delille.org>
Date: Sun, 10 Nov 2019 14:33:30 +0100
Subject: [PATCH 3/3] Fix self assignement in HttpRequest.cpp.mustache

---
 .../src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache  | 2 +-
 samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache
index 80ce348f3ff..6670c2e0abf 100644
--- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache
+++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache
@@ -91,7 +91,7 @@ QByteArray *{{prefix}}HttpRequestWorker::getMultiPartField(const QString &fieldn
 }
 
 void {{prefix}}HttpRequestWorker::setTimeOut(int timeOut){
-    _timeOut = _timeOut;
+    _timeOut = timeOut;
 }
 
 void {{prefix}}HttpRequestWorker::setWorkingDirectory(const QString &path){
diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp
index 7517e9650ea..951b9b911f0 100644
--- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp
+++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp
@@ -100,7 +100,7 @@ QByteArray *PFXHttpRequestWorker::getMultiPartField(const QString &fieldname){
 }
 
 void PFXHttpRequestWorker::setTimeOut(int timeOut){
-    _timeOut = _timeOut;
+    _timeOut = timeOut;
 }
 
 void PFXHttpRequestWorker::setWorkingDirectory(const QString &path){
-- 
GitLab