Android: Fix crash dialog not showing most of the time

This commit is contained in:
UnknownShadow200 2021-09-30 20:12:13 +10:00
parent a93a2273d1
commit 3d7054f90d

View file

@ -698,8 +698,8 @@ public class MainActivity extends Activity {
final Semaphore dialogSem = new Semaphore(0, true); final Semaphore dialogSem = new Semaphore(0, true);
void releaseDialogSem() { void releaseDialogSem() {
// Only release when no free permits (otherwise showAlert doesn't block when called) // Only release when no waiting threads (otherwise showAlert doesn't block when called)
if (dialogSem.availablePermits() > 0) return; if (!dialogSem.hasQueuedThreads()) return;
dialogSem.release(); dialogSem.release();
} }