Showing the changes to libraries/shared/src/SettingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -46,6 +46,15 @@ namespace Setting { · 45 unmodified lines | ||
| 46 | 46 | QCoreApplication::setApplicationName(applicationInfo.value("name").toString()); |
| 47 | 47 | QCoreApplication::setOrganizationName(applicationInfo.value("organizationName").toString()); |
| 48 | 48 | QCoreApplication::setOrganizationDomain(applicationInfo.value("organizationDomain").toString()); |
| 49 | + | |
| 50 | + // Delete Interface.ini.lock file if it exists, otherwise Interface freezes. | |
| 51 | + QSettings settings; | |
| 52 | + QString settingsLockFilename = settings.fileName() + ".lock"; | |
| 53 | + QFile settingsLockFile(settingsLockFilename); | |
| 54 | + if (settingsLockFile.exists()) { | |
| 55 | + bool deleted = settingsLockFile.remove(); | |
| 56 | + qCDebug(shared) << (deleted ? "Deleted" : "Failed to delete") << "settings lock file" << settingsLockFilename; | |
| 57 | + } | |
| 49 | 58 | } |
| 50 | 59 | |
| 51 | 60 | // Sets up the settings private instance. Should only be run once at startup. preInit() must be run beforehand, |
| @@ -58,14 +67,6 @@ namespace Setting { · 6 unmodified lines | ||
| 58 | 67 | privateInstance = new Manager(); |
| 59 | 68 | Q_CHECK_PTR(privateInstance); |
| 60 | 69 | |
| 61 | − // Delete Interface.ini.lock file if it exists, otherwise Interface freezes. | |
| 62 | − QString settingsLockFilename = privateInstance->fileName() + ".lock"; | |
| 63 | − QFile settingsLockFile(settingsLockFilename); | |
| 64 | − if (settingsLockFile.exists()) { | |
| 65 | − bool deleted = settingsLockFile.remove(); | |
| 66 | − qCDebug(shared) << (deleted ? "Deleted" : "Failed to delete") << "settings lock file" << settingsLockFilename; | |
| 67 | − } | |
| 68 | − | |
| 69 | 70 | QObject::connect(privateInstance, SIGNAL(destroyed()), thread, SLOT(quit())); |
| 70 | 71 | QObject::connect(thread, SIGNAL(started()), privateInstance, SLOT(startTimer())); |
| 71 | 72 | QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); |