You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/11/07 17:38:00 UTC

[jira] [Commented] (WEEX-96) Timer exposed on JSContext can not clear and it has potential crash switching globalQueue

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

ASF GitHub Bot commented on WEEX-96:
------------------------------------

GitHub user acton393 opened a pull request:

    https://github.com/apache/incubator-weex/pull/839

    [WEEX-96][iOS] bug-fix about timer exposed on JSContext

    
      In most case , element in cell will be re-use for memory especially in very
    long list, but if add event for this element, here will generate a new view for
    this element,if it's nil due to a  getter method whether it is off-screen.
    
      For instance, image element in cell will re-use if it is disappear in vision area,
    loaded again while it back to visual area. In this case , when it disappear, just
    add event such as click, touch and so on , it will then create a new view,
    and load image again, although it is off-screen.
    
      If the view is not loaded, so won't add gesture or call this view getter to create
    any view until the view is loaded, then it will init events according to record in
    component.
    
    Bug: 98


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

    $ git pull https://github.com/acton393/incubator-weex ios-bugfix-timer-exposed-in-JSContext

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

    https://github.com/apache/incubator-weex/pull/839.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 #839
    
----
commit 45c6c7e6510565030bd8196e194ee0dc542c3f08
Author: acton393 <zh...@gmail.com>
Date:   2017-11-07T15:07:30Z

    [WEEX-96][iOS] bug-fix about timer exposed on JSContext
    
      Timer exposed on the JSContext, so user can access the function,
    though JavaScript, it has setTimeout and setInterval functions, those
    function switch to global queue while execute javaScript code, it may
    have potential crash about thread safe problem, and for setInterval
    function, the timeId can not auto-increment, so it is hard to clear it at
    the end of program.
      Overview the code, the difference between timer module and the
    JSConext timer is  the execution path is more shorter, the JSContext
    timer can execute javascript function immediately, but the timer module
    instruction must be dispatched by weex sdk just like the common modules,
    the JSContext can be used in canvas scene.
    
    Bug: 96

----


> Timer exposed on JSContext can not clear and it has potential crash switching globalQueue
> -----------------------------------------------------------------------------------------
>
>                 Key: WEEX-96
>                 URL: https://issues.apache.org/jira/browse/WEEX-96
>             Project: Weex
>          Issue Type: Bug
>            Reporter: xingZhang
>            Assignee: Adam Feng
>            Priority: Critical
>
> 1. timer can not be clear
>     As the WXJSCoreBridge file  in [line 544](https://github.com/apache/incubator-weex/blob/master/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m#L544)  shows the code, the appId is a string , so it will never be cleared.
> 2. timer execute js function in global queue may have potential crash, it had better execution in current thread.
>     WXJSCoreBridge  https://github.com/apache/incubator-weex/blob/master/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m#L535
> 3. timerId will always be 1, not auto-increment as the count of timer increasing
> https://github.com/apache/incubator-weex/blob/master/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m#L513



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)