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

EXC_BAD_ACCESS in the screen-orientation plugin

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • None
    • None
    • Screen Orientation Plugin 1.4.2
      iOS 10.1.1

    Description

      The screen-orientation plugin sometimes (seldom) throws a EXC_BAD_ACCESS and crashes the app.

      XCode points to the following line in YoikScreenOrientation.m when crashing:

      vc.view.backgroundColor = [UIColor clearColor];

      The reason for the bug is probably that the view should not be changed while it is in a background thread, but the UIView is not thread safe (see Threading Considerations in https://developer.apple.com/reference/uikit/uiview?language=objc).

      The simplest way to fix this is probably to call the following two lines from the main thread (= move them into the dispatch_async(dispatch_get_main_queue() block):

      vc.view.backgroundColor = [UIColor clearColor];
      vc.view.opaque = YES;

      But as I have never seen the the background as described in the comments "as it is briefly visible prior to closing" on my iPhone 6 even if I comment out these lines, I don't know if there might be any negative side effects (but probably not, as the view is presented later anyways)...

      Attachments

        Activity

          People

            Unassigned Unassigned
            snarpch Markus Ruh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: