* nsfont.m (ns_spec_to_descriptor): Retain and autorelease fdesc.
authorJan Djärv <jan.h.d@swipnet.se>
Tue, 14 May 2013 09:34:16 +0000 (11:34 +0200)
committerJan Djärv <jan.h.d@swipnet.se>
Tue, 14 May 2013 09:34:16 +0000 (11:34 +0200)
Fixes: debbugs:14375

src/ChangeLog
src/nsfont.m

index 836f6d4..db766c7 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-14  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsfont.m (ns_spec_to_descriptor): Retain and autorelease
+       fdesc (Bug#14375).
+
 2013-05-12  Paul Eggert  <eggert@cs.ucla.edu>
 
        * image.c (gif_load): Check that subimages fit (Bug#14345).
index ebee363..9ab369d 100644 (file)
@@ -151,10 +151,13 @@ ns_spec_to_descriptor (Lisp_Object font_spec)
     if ([tdict count] > 0)
        [fdAttrs setObject: tdict forKey: NSFontTraitsAttribute];
 
-    fdesc = [NSFontDescriptor fontDescriptorWithFontAttributes: fdAttrs];
+    fdesc = [[[NSFontDescriptor fontDescriptorWithFontAttributes: fdAttrs]
+               retain] autorelease];
+
     if (family != nil)
       {
-       fdesc = [fdesc fontDescriptorWithFamily: family];
+        NSFontDescriptor *fdesc2 = [fdesc fontDescriptorWithFamily: family];
+        fdesc = [[fdesc2 retain] autorelease];
       }
 
     [fdAttrs release];