mirror of
https://github.com/overte-org/overte.git
synced 2025-07-02 07:29:10 +02:00
Delete Interface.ini.lock before accessing to check crash option
This commit is contained in:
parent
b27d25b46e
commit
a98a867b06
1 changed files with 9 additions and 8 deletions
|
@ -46,6 +46,15 @@ namespace Setting {
|
||||||
QCoreApplication::setApplicationName(applicationInfo.value("name").toString());
|
QCoreApplication::setApplicationName(applicationInfo.value("name").toString());
|
||||||
QCoreApplication::setOrganizationName(applicationInfo.value("organizationName").toString());
|
QCoreApplication::setOrganizationName(applicationInfo.value("organizationName").toString());
|
||||||
QCoreApplication::setOrganizationDomain(applicationInfo.value("organizationDomain").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,
|
// 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();
|
privateInstance = new Manager();
|
||||||
Q_CHECK_PTR(privateInstance);
|
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(privateInstance, SIGNAL(destroyed()), thread, SLOT(quit()));
|
||||||
QObject::connect(thread, SIGNAL(started()), privateInstance, SLOT(startTimer()));
|
QObject::connect(thread, SIGNAL(started()), privateInstance, SLOT(startTimer()));
|
||||||
QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||||
|
|
Loading…
Reference in a new issue