History

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

David Rowe committed 11 years ago

Commit a98a8671 parent b27d25b1 file · +9 −8Browse files

Showing the changes to libraries/shared/src/SettingInterface.cpp (1 of 1 file). Show all

Unified · Split

libraries/shared/src/SettingInterface.cpp+9−8
@@ -46,6 +46,15 @@ namespace Setting { · 45 unmodified lines
4646 QCoreApplication::setApplicationName(applicationInfo.value("name").toString());
4747 QCoreApplication::setOrganizationName(applicationInfo.value("organizationName").toString());
4848 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+ }
4958 }
5059
5160 // 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
5867 privateInstance = new Manager();
5968 Q_CHECK_PTR(privateInstance);
6069
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−
6970 QObject::connect(privateInstance, SIGNAL(destroyed()), thread, SLOT(quit()));
7071 QObject::connect(thread, SIGNAL(started()), privateInstance, SLOT(startTimer()));
7172 QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));