Make SettingsDialog robust against multiple accept()/rejects()

That can happen if the user clicks very fast due to the multiple
levels of event loops.

Task-Nr: QTCREATORBUG-4818

Change-Id: I9c00dbf957a587c6e5839afebdd71e84b8c4a3c8
Reviewed-on: http://codereview.qt.nokia.com/16
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
dt_
2011-05-19 14:08:41 +02:00
committed by Daniel Teske
parent 9f7fdc5551
commit c960be456d
2 changed files with 10 additions and 1 deletions

View File

@@ -290,7 +290,8 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
m_categoryList(new CategoryListView),
m_headerLabel(new QLabel),
m_running(false),
m_applied(false)
m_applied(false),
m_finished(false)
{
m_applied = false;
@@ -507,6 +508,9 @@ void SettingsDialog::filter(const QString &text)
void SettingsDialog::accept()
{
if (m_finished)
return;
m_finished = true;
disconnectTabWidgets();
m_applied = true;
foreach (IOptionsPage *page, m_visitedPages)
@@ -518,6 +522,9 @@ void SettingsDialog::accept()
void SettingsDialog::reject()
{
if (m_finished)
return;
m_finished = true;
disconnectTabWidgets();
foreach (IOptionsPage *page, m_pages)
page->finish();
@@ -571,6 +578,7 @@ bool SettingsDialog::execDialog()
{
if (!m_running) {
m_running = true;
m_finished = false;
exec();
m_running = false;
m_instance = 0;