Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-7643

sendPluginResult is not thread safe

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.5.0
    • 3.7.0
    • cordova-ios
    • None

    Description

      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.

      Attachments

        Activity

          People

            shazron Shazron Abdullah
            samedi Richard Hermanson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified