Markus Ruh created CB-12231:
-------------------------------

             Summary: EXC_BAD_ACCESS in the screen-orientation plugin
                 Key: CB-12231
                 URL: https://issues.apache.org/jira/browse/CB-12231
             Project: Apache Cordova
          Issue Type: Bug
          Components: Plugin Screen Orientation
         Environment: Screen Orientation Plugin 1.4.2
iOS 10.1.1
            Reporter: Markus Ruh


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)...



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to