mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 18:30:38 +00:00
(getNSFont): Retain/autorelease when returning a cached instance.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17135 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
974395db91
commit
ad33f29026
1 changed files with 4 additions and 2 deletions
|
@ -258,7 +258,7 @@ static NSFont *getNSFont(float fontSize, int role)
|
|||
font_role |= 1;
|
||||
|
||||
if (font_roles[role].cachedFont)
|
||||
return font_roles[role].cachedFont;
|
||||
return AUTORELEASE(RETAIN(font_roles[role].cachedFont));
|
||||
|
||||
fontSize = [defaults floatForKey:
|
||||
[NSString stringWithFormat: @"%@Size", font_roles[role].key]];
|
||||
|
@ -328,7 +328,9 @@ static void setNSFont(NSString *key, NSFont *font)
|
|||
[defaults setObject: [font fontName] forKey: key];
|
||||
|
||||
for (i = 1; i < RoleMax; i++)
|
||||
DESTROY(font_roles[i].cachedFont);
|
||||
{
|
||||
DESTROY(font_roles[i].cachedFont);
|
||||
}
|
||||
|
||||
/* Don't care about errors */
|
||||
[defaults synchronize];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue