apache / apache/cordova-plugin-dialogs
Race condition with activityStart/activityStop can leave dialog on screen [Android]
- Dominant language
- JavaScript
- Stars
- 294
- Forks
- 352
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Problem
There is a potential race condition problem in `activityStart`/`activityStop`, because the former shows the spinner dialog in the UI thread, while the latter hides the spinner dialog in the JS thread. So it is possible for `activityStop` to try to hide the spinner dialog, while it hasn't event been shown yet, if `activityStop` is executed immediately (or shortly) after `activityStart`.
For instance, using the following code (e.g. in Chrome remote debugging console):
```
navigator.notification.activityStart('', 'Wait...'); navigator.notification.activityStop()
```
### What is expected to happen?
`activityStop` should always discard a spinner dialog initiated by `activityStart`.
### What does actually happen?
`activityStop` has no effect, because the spinner dialog hasn't been created yet by `activityStart` (due to execution in UI thread).
### Environment, Platform, Device
Android
### Version information
- cordova-android@10
- cordova-plugin-dialogs@2.0.2
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Assessment
This issue has not been assessed yet.