From 4da7ab58b890bf888956a153f5e2dee43fb3e965 Mon Sep 17 00:00:00 2001 From: Michiel de Hoon Date: Sat, 11 Jul 2015 01:48:58 +0900 Subject: [PATCH] Use kCTForegroundColorFromContextAttributeName instead of self->color, as the latter is not saved on the stack --- src/_macosx.m | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/_macosx.m b/src/_macosx.m index b3c4ee985190..97f60432c2a8 100644 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -2648,7 +2648,6 @@ static CGFloat _get_device_scale(CGContextRef cr) const char* italic; float angle; CTFontRef font; - CGColorRef color; CGFloat descent; #if PY33 const char* text; @@ -2697,22 +2696,16 @@ static CGFloat _get_device_scale(CGContextRef cr) return NULL; } - color = CGColorCreateGenericRGB(self->color[0], - self->color[1], - self->color[2], - self->color[3]); - keys[0] = kCTFontAttributeName; - keys[1] = kCTForegroundColorAttributeName; + keys[1] = kCTForegroundColorFromContextAttributeName; values[0] = font; - values[1] = color; + values[1] = kCFBooleanTrue; CFDictionaryRef attributes = CFDictionaryCreate(kCFAllocatorDefault, (const void**)&keys, (const void**)&values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - CGColorRelease(color); CFRelease(font); CFAttributedStringRef string = CFAttributedStringCreate(kCFAllocatorDefault,