disconnecting signal if startup dialog closes before http query completes

This commit is contained in:
Vadim Kurland
2010-04-01 17:53:04 +00:00
parent 159b8e796e
commit 718768b849
3 changed files with 15 additions and 2 deletions
+11
View File
@@ -103,6 +103,17 @@ StartTipDialog::~StartTipDialog()
delete http_getter;
};
/*
* disconnect signal in case dialog is closed before http query completes.
* This does happen in unit tests and might happen on slow machines or
* slow internet connections
*/
void StartTipDialog::closeEvent(QCloseEvent *event)
{
disconnect(http_getter, SIGNAL(done(const QString&)),
this, SLOT(downloadComplete(const QString&)));
}
/*
* Returns file name for a random tip
*/
+3 -1
View File
@@ -51,7 +51,8 @@ class StartTipDialog : public QDialog
void showTip(const QString &txt, bool new_tip=true);
void showTip(int tip_idx);
QString getRandomTip();
virtual void closeEvent(QCloseEvent *event);
public:
Ui::StartTipDialog_q *m_dialog;
@@ -67,6 +68,7 @@ public slots:
void prevTip();
void showGettingStartedTutorial();
void showSummary();
virtual void close();
};
@@ -80,7 +80,7 @@ void AddressRangeDialogTest::initTestCase()
mw->startupLoad();
StartTipDialog *d = mw->findChild<StartTipDialog*>();
d->close();
QTest::qWait(1000);
QTest::qWait(10);
}
void AddressRangeDialogTest::checkMessageBox()