Skip to content
Prev Previous commit
Next Next commit
Synchronize setPendingOptionsAndResult
  • Loading branch information
JeroenWeener committed Apr 28, 2023
commit 7fa110109afdb3f769a858d61f92a11ca43236b9
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -191,7 +192,7 @@ public void onScanCompleted(String path, Uri uri) {
}
},
new FileUtils(),
new ThreadPoolExecutor(0, 1, 1L, TimeUnit.SECONDS, new LinkedBlockingQueue<>()));
Executors.newSingleThreadExecutor());
}

/**
Expand Down Expand Up @@ -697,7 +698,7 @@ private void handleVideoResult(String path) {
finishWithSuccess(path);
}

private boolean setPendingOptionsAndResult(
private synchronized boolean setPendingOptionsAndResult(
@Nullable ImageSelectionOptions imageOptions,
@Nullable VideoSelectionOptions videoOptions,
@NonNull Messages.Result<List<String>> result) {
Expand Down