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

Logic error in uninstall frameworks in iOS

    XMLWordPrintableJSON

Details

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

    Description

      This is reference counting code.

      Line: https://github.com/apache/cordova-ios/blob/5c3885b807f4c9556bf350c72400827a333f78d3/bin/templates/scripts/cordova/lib/plugman/pluginHandlers.js#L100

      project.frameworks[src] -= (project.frameworks[src] || 1) - 1;
      

      which expands to:

      project.frameworks[src] = project.frameworks[src] - (project.frameworks[src] || 1) - 1;
      

      project.frameworks[src] would contain a number, or undefined.

      My guess is that the intent of this line is to decrement the reference count by 1. If the count was not set, the resulting count value should be negative, according to the next conditional "if (project.frameworks[src] < 1)

      {" where it would delete the entry in the object. The correct line should be: {code}

      project.frameworks[src] = (project.frameworks[src] || 1) - 1;

      
      

      Attachments

        Issue Links

          Activity

            People

              shazron Shazron Abdullah
              shazron Shazron Abdullah
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: