mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Merge #8540: qt: Fix random segfault when closing "Choose data directory" dialog
b4a9aa5
qt: Fix random segfault when closing "Choose data directory" dialog (Wladimir J. van der Laan)
This commit is contained in:
parent
55ccc56a80
commit
80573f2bf4
@ -623,7 +623,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
/// 5. Now that settings and translations are available, ask user for data directory
|
/// 5. Now that settings and translations are available, ask user for data directory
|
||||||
// User language is set up: pick a 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 dash.conf
|
/// 6. Determine availability of data directory and parse dash.conf
|
||||||
/// - Do not call GetDataDir(true) before this step finishes
|
/// - Do not call GetDataDir(true) before this step finishes
|
||||||
|
@ -166,14 +166,14 @@ QString Intro::getDefaultDataDirectory()
|
|||||||
return GUIUtil::boostPathToQString(GetDefaultDataDir());
|
return GUIUtil::boostPathToQString(GetDefaultDataDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Intro::pickDataDirectory()
|
bool Intro::pickDataDirectory()
|
||||||
{
|
{
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
/* If data directory provided on command line, no need to look at settings
|
/* If data directory provided on command line, no need to look at settings
|
||||||
or show a picking dialog */
|
or show a picking dialog */
|
||||||
if(!GetArg("-datadir", "").empty())
|
if(!GetArg("-datadir", "").empty())
|
||||||
return;
|
return true;
|
||||||
/* 1) Default data directory for operating system */
|
/* 1) Default data directory for operating system */
|
||||||
QString dataDirDefaultCurrent = getDefaultDataDirectory();
|
QString dataDirDefaultCurrent = getDefaultDataDirectory();
|
||||||
/* 2) Allow QSettings to override default dir */
|
/* 2) Allow QSettings to override default dir */
|
||||||
@ -193,7 +193,7 @@ void Intro::pickDataDirectory()
|
|||||||
if(!intro.exec())
|
if(!intro.exec())
|
||||||
{
|
{
|
||||||
/* Cancel clicked */
|
/* Cancel clicked */
|
||||||
exit(EXIT_SUCCESS);
|
return false;
|
||||||
}
|
}
|
||||||
dataDir = intro.getDataDirectory();
|
dataDir = intro.getDataDirectory();
|
||||||
try {
|
try {
|
||||||
@ -215,6 +215,7 @@ void Intro::pickDataDirectory()
|
|||||||
*/
|
*/
|
||||||
if(dataDir != dataDirDefaultCurrent)
|
if(dataDir != dataDirDefaultCurrent)
|
||||||
SoftSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting
|
SoftSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable)
|
void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable)
|
||||||
|
@ -35,10 +35,13 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Determine data directory. Let the user choose if the current one doesn't exist.
|
* Determine data directory. Let the user choose if the current one doesn't exist.
|
||||||
*
|
*
|
||||||
|
* @returns true if a data directory was selected, false if the user cancelled the selection
|
||||||
|
* dialog.
|
||||||
|
*
|
||||||
* @note do NOT call global GetDataDir() before calling this function, this
|
* @note do NOT call global GetDataDir() before calling this function, this
|
||||||
* will cause the wrong path to be cached.
|
* will cause the wrong path to be cached.
|
||||||
*/
|
*/
|
||||||
static void pickDataDirectory();
|
static bool pickDataDirectory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine default data directory for operating system.
|
* Determine default data directory for operating system.
|
||||||
|
Loading…
Reference in New Issue
Block a user