From c146f5202f9f35cf2cc1f779db6da65826f74246 Mon Sep 17 00:00:00 2001 From: Niklas Baudy Date: Tue, 7 Jan 2025 10:39:02 +0800 Subject: [PATCH] Bug fix: Use ConcurrentHashMap to keep track of currentPermissionRequests to avoid multithreading issues. (#268) --- .../java/com/vanniktech/rxpermission/RealRxPermission.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rxpermission/src/main/java/com/vanniktech/rxpermission/RealRxPermission.java b/rxpermission/src/main/java/com/vanniktech/rxpermission/RealRxPermission.java index e6049a8..8b70fa8 100644 --- a/rxpermission/src/main/java/com/vanniktech/rxpermission/RealRxPermission.java +++ b/rxpermission/src/main/java/com/vanniktech/rxpermission/RealRxPermission.java @@ -16,11 +16,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import org.jetbrains.annotations.NotNull; import static android.content.pm.PackageManager.PERMISSION_GRANTED; @@ -54,7 +54,7 @@ public static RealRxPermission getInstance(final Context context) { private final Application application; // Contains all the current permission requests. Once granted or denied, they are removed from it. - private final Map> currentPermissionRequests = new HashMap<>(); + private final Map> currentPermissionRequests = new ConcurrentHashMap<>(); RealRxPermission(final Application application) { this.application = application;