← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~mzanetti/reminders-app/remove-stale-lock-files into lp:reminders-app

 

Michael Zanetti has proposed merging lp:~mzanetti/reminders-app/remove-stale-lock-files into lp:reminders-app.

Commit message:
Cleanup stale .lock files.

This might happen if the app is stopped in the middle of processing a note
and would cause it to wait for the lock release forever on next startup.

Requested reviews:
  Ubuntu Notes app developers (notes-app-dev)

For more details, see:
https://code.launchpad.net/~mzanetti/reminders-app/remove-stale-lock-files/+merge/293355
-- 
Your team Ubuntu Notes app developers is requested to review the proposed merge of lp:~mzanetti/reminders-app/remove-stale-lock-files into lp:reminders-app.
=== modified file 'src/libqtevernote/notesstore.cpp'
--- src/libqtevernote/notesstore.cpp	2015-11-02 20:26:37 +0000
+++ src/libqtevernote/notesstore.cpp	2016-04-29 07:49:14 +0000
@@ -107,6 +107,13 @@
         m_username = username;
         emit usernameChanged();
 
+        QDir storageDir(storageLocation());
+        foreach (const QString &fileName, storageDir.entryList({"*.lock"})) {
+            qCDebug(dcNotesStore) << "Removing stale lock file" << storageLocation() + "/" + fileName;
+            QFile f(storageLocation() +  "/" + fileName);
+            f.remove();
+        }
+
         m_cacheFile = storageLocation() + "notes.cache";
         qCDebug(dcNotesStore) << "Initialized cacheFile:" << m_cacheFile;
         loadFromCacheFile();


Follow ups