From 82b73ab03a7f2f519ad8efd176a8f3be7a9b9f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 12 Dec 2011 09:52:40 +0100 Subject: Cocoa: Add autorelease pools. A couple of cases where we call Cococa APIs without having an autorelease pool in place surfaced after removing the global autorelease pool in 1a218a7. (This happens when when Qt API is called before app.exec() has started the Cocoa event loop.) Add local autorelease pools to prevent memory leaks. Change-Id: I0c4be3ff102aaff4539235857f95ab29fdbc9d70 Reviewed-by: Richard Moe Gustavsen --- src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 6c3e403c51..9dbc60f6c7 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -159,6 +159,8 @@ static QString familyNameFromPostScriptName(QHash &psNameToFam void QCoreTextFontDatabase::populateFontDatabase() { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + QCFType collection = CTFontCollectionCreateFromAvailableFonts(0); if (! collection) return; @@ -243,8 +245,6 @@ void QCoreTextFontDatabase::populateFontDatabase() NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"]; - NSAutoreleasePool *pool = [NSAutoreleasePool new]; - NSDictionary *fallbackDict = [NSDictionary dictionaryWithContentsOfFile: @"/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist"]; for (NSString *style in [fallbackDict allKeys]) { -- cgit v1.2.3