Commit 44bd5a73 authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

fix syncContentData to be executed on ui thread

parent bcf99d5f
......@@ -22,6 +22,13 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
......@@ -31,18 +38,8 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<dict>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
......@@ -284,6 +284,7 @@ RCT_NOT_IMPLEMENTED(-init)
- (void)syncContentData
{
RCT_PROFILE_BEGIN_EVENT(0, @"GLCanvas syncContentData", nil);
NSMutableArray *contentData = [[NSMutableArray alloc] init];
int nb = [_nbContentTextures intValue];
for (int i = 0; i < nb; i++) {
......@@ -300,6 +301,9 @@ RCT_NOT_IMPLEMENTED(-init)
contentData[i] = imgData;
}
_contentData = contentData;
_deferredRendering = true;
[self setNeedsDisplay];
RCT_PROFILE_END_EVENT(0, @"gl", nil);
}
......@@ -346,12 +350,7 @@ RCT_NOT_IMPLEMENTED(-init)
BOOL needsDeferredRendering = _nbContentTextures > 0 && !_autoRedraw;
if (needsDeferredRendering && !_deferredRendering) {
dispatch_async(dispatch_get_main_queue(), ^{
if (!weakSelf) return;
_deferredRendering = true;
[self syncContentData];
[weakSelf setNeedsDisplay];
});
[self performSelectorOnMainThread:@selector(syncContentData) withObject:nil waitUntilDone:NO];
}
else {
RCT_PROFILE_BEGIN_EVENT(0, @"GLCanvas render", nil);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment