cordova-plugin-dialogs icon indicating copy to clipboard operation
cordova-plugin-dialogs copied to clipboard

Race condition with activityStart/activityStop can leave dialog on screen [Android]

Open goffioul opened this issue 3 years ago • 0 comments

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

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

goffioul avatar May 10 '22 13:05 goffioul