You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/02/25 02:05:18 UTC

[jira] [Commented] (CB-10692) [Android] SplashScreen plugin crashes due to race condition on hide

    [ https://issues.apache.org/jira/browse/CB-10692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15166474#comment-15166474 ] 

ASF GitHub Bot commented on CB-10692:
-------------------------------------

GitHub user dpolivy opened a pull request:

    https://github.com/apache/cordova-plugin-splashscreen/pull/86

    CB-10692 Don't fade when plugin is forced to close

    The fading logic exposed a race condition in an edge case when the
    plugin was repeatedly reinitialized, e.g. when the WebView tries to load
    a new URL. To address this, we add a flag to removeSplashScreen() that
    allows the fade logic to be bypassed in certain circumstances --
    specifically, when hiding the splashscreen due to onPause or onDestroy
    events. By hiding it immediately in this scenario, we can avoid any race
    conditions due to the fade delay.
    
    Fixes https://issues.apache.org/jira/browse/CB-10692

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dpolivy/cordova-plugin-splashscreen CB10692

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-splashscreen/pull/86.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #86
    
----
commit 48bb4ad4532d960bd6b40b382f915089b726ed26
Author: Dan Polivy <da...@cellartracker.com>
Date:   2016-02-25T01:03:58Z

    CB-10692 Don't fade when plugin is forced to close
    
    The fading logic exposed a race condition in an edge case when the
    plugin was repeatedly reinitialized, e.g. when the WebView tries to load
    a new URL. To address this, we add a flag to removeSplashScreen() that
    allows the fade logic to be bypassed in certain circumstances --
    specifically, when hiding the splashscreen due to onPause or onDestroy
    events. By hiding it immediately in this scenario, we can avoid any race
    conditions due to the fade delay.

----


> [Android] SplashScreen plugin crashes due to race condition on hide
> -------------------------------------------------------------------
>
>                 Key: CB-10692
>                 URL: https://issues.apache.org/jira/browse/CB-10692
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin SplashScreen
>    Affects Versions: 3.2.0
>            Reporter: Dan Polivy
>
> On Android, there is a small race condition in the code to hide the splash screen when a fade out is used. It may only be visible in certain edge cases, but the net result is that the app will crash.
> Specifically, if multiple calls come in to {{removeSplashScreen}} in a row, it's possible for the first call to null out {{splashImageView}} before the second call uses it (but after the second call tests for {{splashDialog == null}}), because of the animation delay.
> Crashing code: https://github.com/apache/cordova-plugin-splashscreen/blob/master/src/android/SplashScreen.java#L219
> My repro for this scenario is due to having a native dialog box that appears if we have a network connection error when trying to connect to the starting URL (in my case, it is a remote URL). The dialog box has a 'retry' button which allows the user to retry the network request. When the user does this, we tell the webview to load a new URL; the webview then re-initializes the plugin manager, which in turn sends onPause and onDestroy events to the Splash Screen plugin. It's this sequence of events, which, in quick succession, can trigger the crash.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org