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 2014/09/26 00:50:34 UTC

[jira] [Commented] (CB-7643) sendPluginResult is not thread safe

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

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

GitHub user samedii opened a pull request:

    https://github.com/apache/cordova-ios/pull/108

    Made isValidCallbackId threadsafe (Bug CB-7643)

    _callbackIdPattern was being changed on multiple threads which caused bad access errors
    https://issues.apache.org/jira/browse/CB-7643

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

    $ git pull https://github.com/samedii/cordova-ios patch-1

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

    https://github.com/apache/cordova-ios/pull/108.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 #108
    
----
commit 6858fa6ab311d05972ce2919798d96478de9ebd5
Author: samedii <sa...@gmail.com>
Date:   2014-09-25T22:49:08Z

    Made isValidCallbackId threadsafe (Bug CB-7643)
    
    _callbackIdPattern was being changed on multiple threads which caused bad access errors

----


> sendPluginResult is not thread safe
> -----------------------------------
>
>                 Key: CB-7643
>                 URL: https://issues.apache.org/jira/browse/CB-7643
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 3.5.0
>            Reporter: Richard Hermanson
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> If _callbackIdPattern in CVDCommandDelegateImpl.m is set at the same time as it is used (in different threads) then there's an error thrown (EXC_BAD_ACCESS).
> More precisely when this line is run in one thread:
> _callbackIdPattern = [NSRegularExpression regularExpressionWithPattern:@"[^A-Za-z0-9._-]" options:0 error:&err];
> and this in another:
>     if (([callbackId length] > 100) || [_callbackIdPattern firstMatchInString:callbackId options:0 range:NSMakeRange(0, [callbackId length])]) {
> The method is: - (BOOL)isValidCallbackId:(NSString *)callbackId
> This happens about every 10th time I start my application. I could surely solve this by not calling too quickly and repeatedly but this is still a bug and easily fixed.



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