Skip to content

Commit

Permalink
Bug fix: Use ConcurrentHashMap to keep track of currentPermissionRequ…
Browse files Browse the repository at this point in the history
…ests to avoid multithreading issues. (#268)
  • Loading branch information
vanniktech authored Jan 7, 2025
1 parent b8b2378 commit c146f52
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String, PublishSubject<Permission>> currentPermissionRequests = new HashMap<>();
private final Map<String, PublishSubject<Permission>> currentPermissionRequests = new ConcurrentHashMap<>();

RealRxPermission(final Application application) {
this.application = application;
Expand Down

0 comments on commit c146f52

Please sign in to comment.