From 5050a2bfa008a86e995ff29be1cf03929f44af54 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 14 Sep 2016 08:12:49 +0200 Subject: [PATCH] Fixed: Infinite loop when clicking on OK in profiles dialog, see #279 --HG-- branch : develop --- .../ryzom_installer/src/operationdialog.cpp | 24 +++++++++++++++---- .../ryzom_installer/src/operationdialog.h | 4 ++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index da7a2f52d..6ea65aeeb 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -92,7 +92,7 @@ void COperationDialog::processNextStep() { if (operationShouldStop()) { - reject(); + rejectDelayed(); return; } @@ -184,7 +184,7 @@ void COperationDialog::processInstallNextStep() break; case Done: - accept(); + acceptDelayed(); break; default: @@ -253,6 +253,8 @@ void COperationDialog::updateAddRemoveComponents() void COperationDialog::processUpdateProfilesNextStep() { + m_currentOperation = tr("Update profiles"); + // for "update profiles" operations, we set installer to false when components are updated, // since we're not using this variable if (m_addComponents.installer && m_removeComponents.installer) @@ -344,6 +346,8 @@ void COperationDialog::processUpdateProfilesNextStep() } updateAddRemoveEntry(); + + acceptDelayed(); } void COperationDialog::processUninstallNextStep() @@ -369,7 +373,7 @@ void COperationDialog::processUninstallNextStep() else { // done - accept(); + acceptDelayed(); } } @@ -460,7 +464,7 @@ void COperationDialog::onProgressStop() m_button->progress()->hide(); #endif - reject(); + rejectDelayed(); } void COperationDialog::onProgressProgress(qint64 current, const QString &filename) @@ -1247,3 +1251,15 @@ void COperationDialog::renamePartFile() QFile::rename(partFile, finalFile); } } + +void COperationDialog::acceptDelayed() +{ + // wait 500ms before to call accept() + QTimer::singleShot(500, this, SLOT(accept())); +} + +void COperationDialog::rejectDelayed() +{ + // wait 500ms before to call reject() + QTimer::singleShot(500, this, SLOT(reject())); +} diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index e9966c4d2..d2172815c 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -133,6 +133,10 @@ protected: void renamePartFile(); + // hacks to prevent an infinite loop + void acceptDelayed(); + void rejectDelayed(); + QWinTaskbarButton *m_button; CDownloader *m_downloader;