aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/QuartzTextStyle.h
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2011-07-11 15:40:24 +1000
committernyamatongwe <devnull@localhost>2011-07-11 15:40:24 +1000
commit34c751df2e9db01f8209510256831ec14dc6fd9f (patch)
tree7de2f8d024456d49d76ad3ec7c65f41fdacaec0f /cocoa/QuartzTextStyle.h
parent15c3e1203d85d128a0432a35a5674763e1cac7b7 (diff)
downloadscintilla-mirror-34c751df2e9db01f8209510256831ec14dc6fd9f.tar.gz
Fix memory leaks for font and color objects.
Diffstat (limited to 'cocoa/QuartzTextStyle.h')
-rw-r--r--cocoa/QuartzTextStyle.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/cocoa/QuartzTextStyle.h b/cocoa/QuartzTextStyle.h
index 099684ca7..51d03cf91 100644
--- a/cocoa/QuartzTextStyle.h
+++ b/cocoa/QuartzTextStyle.h
@@ -16,7 +16,10 @@ public:
QuartzTextStyle()
{
fontRef = NULL;
- styleDict = CFDictionaryCreateMutable(NULL, 1, NULL, NULL);
+ styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+
characterSet = 0;
}
@@ -27,6 +30,12 @@ public:
CFRelease(styleDict);
styleDict = NULL;
}
+
+ if (fontRef)
+ {
+ CFRelease(fontRef);
+ fontRef = NULL;
+ }
}
CFMutableDictionaryRef getCTStyle() const
@@ -62,7 +71,9 @@ public:
if (styleDict != NULL)
CFRelease(styleDict);
- styleDict = CFDictionaryCreateMutable(NULL, 1, NULL, NULL);
+ styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef);
}