Fixed: Infinite loop when clicking on OK in profiles dialog, see #279

This commit is contained in:
kervala 2016-09-14 08:12:49 +02:00
parent 081a34ffce
commit a5c209f83b
2 changed files with 24 additions and 4 deletions

View file

@ -92,7 +92,7 @@ void COperationDialog::processNextStep()
{ {
if (operationShouldStop()) if (operationShouldStop())
{ {
reject(); rejectDelayed();
return; return;
} }
@ -184,7 +184,7 @@ void COperationDialog::processInstallNextStep()
break; break;
case Done: case Done:
accept(); acceptDelayed();
break; break;
default: default:
@ -253,6 +253,8 @@ void COperationDialog::updateAddRemoveComponents()
void COperationDialog::processUpdateProfilesNextStep() void COperationDialog::processUpdateProfilesNextStep()
{ {
m_currentOperation = tr("Update profiles");
// for "update profiles" operations, we set installer to false when components are updated, // for "update profiles" operations, we set installer to false when components are updated,
// since we're not using this variable // since we're not using this variable
if (m_addComponents.installer && m_removeComponents.installer) if (m_addComponents.installer && m_removeComponents.installer)
@ -344,6 +346,8 @@ void COperationDialog::processUpdateProfilesNextStep()
} }
updateAddRemoveEntry(); updateAddRemoveEntry();
acceptDelayed();
} }
void COperationDialog::processUninstallNextStep() void COperationDialog::processUninstallNextStep()
@ -369,7 +373,7 @@ void COperationDialog::processUninstallNextStep()
else else
{ {
// done // done
accept(); acceptDelayed();
} }
} }
@ -460,7 +464,7 @@ void COperationDialog::onProgressStop()
m_button->progress()->hide(); m_button->progress()->hide();
#endif #endif
reject(); rejectDelayed();
} }
void COperationDialog::onProgressProgress(qint64 current, const QString &filename) void COperationDialog::onProgressProgress(qint64 current, const QString &filename)
@ -1247,3 +1251,15 @@ void COperationDialog::renamePartFile()
QFile::rename(partFile, finalFile); 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()));
}

View file

@ -133,6 +133,10 @@ protected:
void renamePartFile(); void renamePartFile();
// hacks to prevent an infinite loop
void acceptDelayed();
void rejectDelayed();
QWinTaskbarButton *m_button; QWinTaskbarButton *m_button;
CDownloader *m_downloader; CDownloader *m_downloader;