GNU bug report logs -
#11541
24.0.97; Crash when visiting file on OS X 10.7.3
Previous Next
Full log
Message #184 received at 11541 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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]);
[Message part 2 (text/html, inline)]
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.