aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-07-31 22:15:05 -0700
committerWladimir J. van der Laan <laanwj@gmail.com>2013-07-31 22:15:05 -0700
commit6d89611c3aaa85798c4d70d20e35e6bcb7bdd5c0 (patch)
tree63a72d6290638726f5604c552a577bfb1de54f31 /src
parent3b2ed514d3c157a81f6e882ec2e92b6329f712f5 (diff)
parent5bc6d8e5802500a6ffd737185f30283bc65eba58 (diff)
Merge pull request #2850 from Diapolo/fix_intro
fix possible infinite loop in intro.cpp thread
Diffstat (limited to 'src')
-rw-r--r--src/qt/intro.cpp10
-rw-r--r--src/qt/intro.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp
index 51f3c812e4..944899d3e8 100644
--- a/src/qt/intro.cpp
+++ b/src/qt/intro.cpp
@@ -25,6 +25,7 @@ static const uint64 BLOCK_CHAIN_SIZE = 10LL * GB_BYTES;
class FreespaceChecker : public QObject
{
Q_OBJECT
+
public:
FreespaceChecker(Intro *intro);
@@ -61,9 +62,16 @@ void FreespaceChecker::check()
/* Find first parent that exists, so that fs::space does not fail */
fs::path parentDir = dataDir;
+ fs::path parentDirOld = fs::path();
while(parentDir.has_parent_path() && !fs::exists(parentDir))
{
parentDir = parentDir.parent_path();
+
+ /* Check if we make any progress, break if not to prevent an infinite loop here */
+ if (parentDirOld == parentDir)
+ break;
+
+ parentDirOld = parentDir;
}
try {
@@ -201,7 +209,7 @@ void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable
} else {
ui->freeSpace->setStyleSheet("");
}
- ui->freeSpace->setText(freeString+".");
+ ui->freeSpace->setText(freeString + ".");
}
/* Don't allow confirm in ERROR state */
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(status != FreespaceChecker::ST_ERROR);
diff --git a/src/qt/intro.h b/src/qt/intro.h
index b246c65a82..788799b7b0 100644
--- a/src/qt/intro.h
+++ b/src/qt/intro.h
@@ -37,6 +37,7 @@ public:
* Determine default data directory for operating system.
*/
static QString getDefaultDataDirectory();
+
signals:
void requestCheck();
void stopThread();