From c98d01415fdeded8440ba19799925eb1f095e0f6 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Wed, 10 Jun 2020 15:16:22 +0200 Subject: [PATCH] NoteRename: Do it before trying to get the lock Another operation coule be blocking git. --- lib/state_container.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/state_container.dart b/lib/state_container.dart index b9f15326..de638cbf 100644 --- a/lib/state_container.dart +++ b/lib/state_container.dart @@ -204,12 +204,12 @@ class StateContainer with ChangeNotifier { void renameNote(Note note, String newFileName) async { logEvent(Event.NoteRenamed); + var oldNotePath = note.filePath; + note.rename(newFileName); + return _opLock.synchronized(() async { Log.d("Got renameNote lock"); - var oldNotePath = note.filePath; - note.rename(newFileName); - _gitRepo.renameNote(oldNotePath, note.filePath).then((NoteRepoResult _) { _syncNotes(); appState.numChanges += 1;