Delete Interface.ini.lock before accessing to check crash option

This commit is contained in:
David Rowe 2015-08-25 11:07:20 -07:00
parent b27d25b46e
commit a98a867b06

View file

@ -46,6 +46,15 @@ namespace Setting {
QCoreApplication::setApplicationName(applicationInfo.value("name").toString());
QCoreApplication::setOrganizationName(applicationInfo.value("organizationName").toString());
QCoreApplication::setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
// Delete Interface.ini.lock file if it exists, otherwise Interface freezes.
QSettings settings;
QString settingsLockFilename = settings.fileName() + ".lock";
QFile settingsLockFile(settingsLockFilename);
if (settingsLockFile.exists()) {
bool deleted = settingsLockFile.remove();
qCDebug(shared) << (deleted ? "Deleted" : "Failed to delete") << "settings lock file" << settingsLockFilename;
}
}
// Sets up the settings private instance. Should only be run once at startup. preInit() must be run beforehand,
@ -58,14 +67,6 @@ namespace Setting {
privateInstance = new Manager();
Q_CHECK_PTR(privateInstance);
// Delete Interface.ini.lock file if it exists, otherwise Interface freezes.
QString settingsLockFilename = privateInstance->fileName() + ".lock";
QFile settingsLockFile(settingsLockFilename);
if (settingsLockFile.exists()) {
bool deleted = settingsLockFile.remove();
qCDebug(shared) << (deleted ? "Deleted" : "Failed to delete") << "settings lock file" << settingsLockFilename;
}
QObject::connect(privateInstance, SIGNAL(destroyed()), thread, SLOT(quit()));
QObject::connect(thread, SIGNAL(started()), privateInstance, SLOT(startTimer()));
QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));