Fixed ART Text

Summary:
ART text was crashing due to a bug in the release logic.
This commit is contained in:
Nick Lockwood 2015-07-10 11:06:19 -01:00
parent 4f464962a0
commit 9229eadff0
2 changed files with 15 additions and 16 deletions

View File

@ -19,15 +19,22 @@
_alignment = alignment;
}
static void ARTFreeTextFrame(ARTTextFrame frame)
{
if (frame.count) {
// We must release each line before freeing up this struct
for (int i = 0; i < frame.count; i++) {
CFRelease(frame.lines[i]);
}
free(frame.lines);
free(frame.widths);
}
}
- (void)setTextFrame:(ARTTextFrame)frame
{
if (frame.lines != _textFrame.lines && _textFrame.count) {
// We must release each line before overriding the old one
for (int i = 0; i < _textFrame.count; i++) {
CFRelease(_textFrame.lines[0]);
}
free(_textFrame.lines);
free(_textFrame.widths);
if (frame.lines != _textFrame.lines) {
ARTFreeTextFrame(_textFrame);
}
[self invalidate];
_textFrame = frame;
@ -35,14 +42,7 @@
- (void)dealloc
{
if (_textFrame.count) {
// We must release each line before freeing up this struct
for (int i = 0; i < _textFrame.count; i++) {
CFRelease(_textFrame.lines[0]);
}
free(_textFrame.lines);
free(_textFrame.widths);
}
ARTFreeTextFrame(_textFrame);
}
- (void)renderLayerTo:(CGContextRef)context

View File

@ -38,7 +38,6 @@ typedef void (^RCTPromiseResolveBlock)(id result);
*/
typedef void (^RCTPromiseRejectBlock)(NSError *error);
/**
* This constant can be returned from +methodQueue to force module
* methods to be called on the JavaScript thread. This can have serious