Blob Blame History Raw
From 326578a1ff79a83b748e6575cffd727521425b09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cristian=20One=C8=9B?= <onet.cristian@gmail.com>
Date: Mon, 26 Nov 2012 21:27:33 +0200
Subject: [PATCH 10/22] Fix a possible crash while mapping an OFX account.

The possibility occurred because the event loop is running
while the https request is performed. To avoid the crash
disable the back button.

BUG: 296681
(cherry picked from commit 62c62948cad0841dc585146a7ad55ee533d86097)
---
 kmymoney/plugins/ofximport/dialogs/konlinebankingsetupwizard.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kmymoney/plugins/ofximport/dialogs/konlinebankingsetupwizard.cpp b/kmymoney/plugins/ofximport/dialogs/konlinebankingsetupwizard.cpp
index 8c3738b..8739ad4 100644
--- a/kmymoney/plugins/ofximport/dialogs/konlinebankingsetupwizard.cpp
+++ b/kmymoney/plugins/ofximport/dialogs/konlinebankingsetupwizard.cpp
@@ -326,7 +326,13 @@ bool KOnlineBankingSetupWizard::finishLoginPage(void)
 
     KUrl filename(QString("%1response.ofx").arg(KStandardDirs::locateLocal("appdata", "")));
     QByteArray req(libofx_request_accountinfo(&fi));
+    // because the event loop is running while the request is performed disable the back button
+    // (this function is not reentrant so the application might crash when back/next are used)
+    QAbstractButton *backButton = button(QWizard::BackButton);
+    bool backButtonState = backButton->isEnabled();
+    backButton->setEnabled(false);
     OfxHttpsRequest(QString("POST"), KUrl((*m_it_info).url), req, QMap<QString, QString>(), filename, true);
+    backButton->setEnabled(backButtonState);
 
     LibofxContextPtr ctx = libofx_get_new_context();
     Q_CHECK_PTR(ctx);
-- 
1.8.1.4