diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-08-18 16:58:04 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-08-18 16:58:25 +0200 |
commit | b4a9aa511c95a1bd0da8ae363b3b9c0b3b7afe4e (patch) | |
tree | 8aa54ab822f23670a1e8cce4520e0b2baa114d6a /src/qt/bitcoin.cpp | |
parent | 8250de13587ed05ca45df3e12c5dc9bcb1500e2c (diff) |
qt: Fix random segfault when closing "Choose data directory" dialog
The `pickDataDirectory()` function was calling `exit(0)` to quit
the application when the user closes the dialog without choosing
a data directory.
This is a bad idea because a background thread is created (to
check free space on the drive of the currently selected datadir).
The thread is not stopped and unwound properly, resulting in a potential
race condition somewhere deep in Qt.
So replace the `exit()` by a boolean return value, and let the
stack unwind normally.
Diffstat (limited to 'src/qt/bitcoin.cpp')
-rw-r--r-- | src/qt/bitcoin.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 64b5c83d72..430e6dd0e8 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -578,7 +578,8 @@ int main(int argc, char *argv[]) /// 5. Now that settings and translations are available, ask user for data directory // User language is set up: pick a data directory - Intro::pickDataDirectory(); + if (!Intro::pickDataDirectory()) + return 0; /// 6. Determine availability of data directory and parse bitcoin.conf /// - Do not call GetDataDir(true) before this step finishes |