diff --git a/.github/workflows/preview-apk.yml b/.github/workflows/preview-apk.yml index cc509841f4..e297073fe2 100644 --- a/.github/workflows/preview-apk.yml +++ b/.github/workflows/preview-apk.yml @@ -49,7 +49,7 @@ jobs: run: ./gradlew --no-daemon assembleGplayDebug - name: Upload APK - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: app-preview.apk path: 'build/outputs/apk/gplay/debug/*.apk' diff --git a/src/main/java/org/thoughtcrime/securesms/service/FetchForegroundService.java b/src/main/java/org/thoughtcrime/securesms/service/FetchForegroundService.java index 47b93b4d80..3415596633 100644 --- a/src/main/java/org/thoughtcrime/securesms/service/FetchForegroundService.java +++ b/src/main/java/org/thoughtcrime/securesms/service/FetchForegroundService.java @@ -49,12 +49,14 @@ public static void start(Context context) { // The background fetch was successful, but we need to wait until all events were processed. // After all events were processed, we will get DC_EVENT_ACCOUNTS_BACKGROUND_FETCH_DONE, // and stop() will be called. - while (fetchingSynchronously) { - try { - // The `wait()` needs to be enclosed in a while loop because there may be - // "spurious wake-ups", i.e. `wait()` may return even though `notifyAll()` wasn't called. - STOP_NOTIFIER.wait(); - } catch (InterruptedException ex) { } + synchronized (STOP_NOTIFIER) { + while (fetchingSynchronously) { + try { + // The `wait()` needs to be enclosed in a while loop because there may be + // "spurious wake-ups", i.e. `wait()` may return even though `notifyAll()` wasn't called. + STOP_NOTIFIER.wait(); + } catch (InterruptedException ex) {} + } } } } @@ -63,7 +65,9 @@ public static void start(Context context) { public static void stop(Context context) { if (fetchingSynchronously) { fetchingSynchronously = false; - STOP_NOTIFIER.notifyAll(); + synchronized (STOP_NOTIFIER) { + STOP_NOTIFIER.notifyAll(); + } } synchronized (SERVICE_LOCK) {