diff --git a/Libraries/ART/ARTText.m b/Libraries/ART/ARTText.m index 7c8a57027..dfffde265 100644 --- a/Libraries/ART/ARTText.m +++ b/Libraries/ART/ARTText.m @@ -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 diff --git a/React/Base/RCTBridgeModule.h b/React/Base/RCTBridgeModule.h index 15937a9f6..8efbef462 100644 --- a/React/Base/RCTBridgeModule.h +++ b/React/Base/RCTBridgeModule.h @@ -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