Commit e43409fc authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

Fix crash when swap some GLCanvas props

probable race condition fixed, syncData is not executed during the draw phase
parent 1e2457e0
......@@ -49,6 +49,8 @@ NSString* srcResource (id res)
NSTimer *animationTimer;
int _lastCaptureId;
BOOL _needSync;
}
- (instancetype)initWithBridge:(RCTBridge *)bridge
......@@ -153,7 +155,8 @@ RCT_NOT_IMPLEMENTED(-init)
- (void)requestSyncData
{
[self syncData];
_needSync = true;
[self setNeedsDisplay];
}
- (void)syncData
......@@ -191,6 +194,7 @@ RCT_NOT_IMPLEMENTED(-init)
id value = [data.uniforms objectForKey:uniformName];
GLenum type = [uniformTypes[uniformName] intValue];
if (type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE) {
uniforms[uniformName] = [NSNumber numberWithInt:units++];
if ([value isEqual:[NSNull null]]) {
......@@ -269,8 +273,6 @@ RCT_NOT_IMPLEMENTED(-init)
_renderData = traverseTree(_data);
_images = images;
[self setNeedsDisplay];
}
}
......@@ -296,6 +298,10 @@ RCT_NOT_IMPLEMENTED(-init)
- (void)drawRect:(CGRect)rect
{
if (_needSync) {
_needSync = false;
[self syncData];
}
self.layer.opaque = _opaque;
[self syncEventsThrough];
__weak GLCanvas *weakSelf = self;
......
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