GNU bug report logs - #11541
24.0.97; Crash when visiting file on OS X 10.7.3

Previous Next

Packages: emacs, ns;

Reported by: Florian Ebeling <florian.ebeling <at> gmail.com>

Date: Tue, 22 May 2012 16:20:02 UTC

Severity: important

Merged with 11684, 11792, 11801

Found in versions 24.0.97, 24.1.50, 24.1

Done: Jan Djärv <jan.h.d <at> swipnet.se>

Bug is archived. No further changes may be made.

Full log


Message #191 received at 11541-done <at> debbugs.gnu.org (full text, mbox):

From: Jan Djärv <jan.h.d <at> swipnet.se>
To: Thomas Kappler <tkappler <at> gmail.com>
Cc: "11541-done <at> debbugs.gnu.org" <11541-done <at> debbugs.gnu.org>
Subject: Re: bug#11541: Possible fix
Date: Thu, 8 Nov 2012 20:53:32 +0100
Hello.

If it works, that is good.  I installed it in the trunk.

Thanks,

	Jan D.

6 nov 2012 kl. 12:01 skrev Thomas Kappler <tkappler <at> gmail.com>:

> I investigated this a bit further and have a patch that fixes the right-arrow test file for me, I can open it and the arrow displays without problems.
> 
> Note that this is my very first foray into the Emacs source as well as into Objective-C.
> 
> The problem is that ns_findfonts is being passed an empty font_spec. (Why, I have no idea.) This crashes "[fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys]". The fix is to check for this case and, if there are no keys in the font_spec, simply initialize matchingDescs to an empty array.
> 
> Cheers,
> Thomas
> 
> 
> $ bzr diff
> 
> === modified file 'src/nsfont.m'
> --- src/nsfont.m    2012-10-21 18:48:11 +0000
> +++ src/nsfont.m    2012-11-06 10:55:25 +0000
> @@ -43,7 +43,7 @@
>  #import <AppKit/NSFontDescriptor.h>
>  #endif
>  
> -#define NSFONT_TRACE 0
> +#define NSFONT_TRACE 1
>  
>  extern Lisp_Object Qns;
>  extern Lisp_Object Qnormal, Qbold, Qitalic, Qcondensed, Qexpanded;
> @@ -556,10 +556,17 @@
>  
>      fdesc = ns_spec_to_descriptor (font_spec);
>      fkeys = [NSMutableSet setWithArray: [[fdesc fontAttributes] allKeys]];
> +    if (NSFONT_TRACE)
> +        NSLog(@"Got %d fkeys: %@ ", [fkeys count], fkeys);
> +    
>      if (isMatch)
>      [fkeys removeObject: NSFontFamilyAttribute];
>  
> -    matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
> +    if ([fkeys count] > 0) {
> +    matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
> +    } else {
> +    matchingDescs = [NSMutableArray array];
> +    }
>      if (NSFONT_TRACE)
>      NSLog(@"Got desc %@ and found %d matching fonts from it: ", fdesc,
>            [matchingDescs count]);
> 





This bug report was last modified 12 years and 255 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.