From 53926a28303e2862a8f861aa492feb3bdbb015b9 Mon Sep 17 00:00:00 2001 From: crschnick Date: Mon, 22 Jan 2024 12:33:26 +0000 Subject: [PATCH] Fix save race condition --- app/src/main/java/io/xpipe/app/storage/StandardStorage.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/storage/StandardStorage.java b/app/src/main/java/io/xpipe/app/storage/StandardStorage.java index 66064ef0c..4602647c3 100644 --- a/app/src/main/java/io/xpipe/app/storage/StandardStorage.java +++ b/app/src/main/java/io/xpipe/app/storage/StandardStorage.java @@ -303,11 +303,12 @@ public class StandardStorage extends DataStorage { } public void save(boolean dispose) { - if (!loaded || disposed) { + if (!busyIo.tryLock()) { return; } - if (!busyIo.tryLock()) { + if (!loaded || disposed) { + busyIo.unlock(); return; }