all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] ftfont.c seg fault problem
@ 2009-01-16 14:28 Lynbech Christian
  2009-01-19 12:13 ` Kenichi Handa
  0 siblings, 1 reply; 3+ messages in thread
From: Lynbech Christian @ 2009-01-16 14:28 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]

I have had a number of problems with recent updates of emacs 23
segmentation faulting on me when trying to use the font backend and
antialiased fonts.

I am unsure exactly what is causing the problem. It works fine when I
compile it on a rather freshly updated debian system but the problem
hits when trying to build and run on my primary workstation which is a
SuSE SLED 10 SP1 system with some additional software installed. In
particular this system doesn't really have gtk+ 2.0 and fontconfig
claims to be version 2.3.94 and I am enabling the font backend and is
trying to use fancy anti-aliased fonts.

The problem hits in src/ftfont.c (ftfont_lookup_cache). The attached
patch seems to alleviate the problem, at least to the point where emacs
stops segmentation faulting. Even if the problem ultimately is a
unfortunate combination of old libraries, I believe the patch is
innocent enough to warrant inclusion.

More information can be provided if you like.

                              -- Christian


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: diff:ftfont.c --]
[-- Type: text/x-csrc, Size: 645 bytes --]

Index: ftfont.c
===================================================================
--- ftfont.c	(revision 1405)
+++ ftfont.c	(working copy)
@@ -311,8 +311,9 @@
 	  objset = FcObjectSetBuild (FC_CHARSET, NULL);
 	  fontset = FcFontList (NULL, pat, objset);
 	  xassert (fontset && fontset->nfont > 0);
-	  if (FcPatternGetCharSet (fontset->fonts[0], FC_CHARSET, 0, &charset)
-	      == FcResultMatch)
+	  if (fontset->fonts &&
+	      (FcPatternGetCharSet (fontset->fonts[0], FC_CHARSET, 0, &charset)
+	       == FcResultMatch))
 	    cache_data->fc_charset = FcCharSetCopy (charset);
 	  else
 	    cache_data->fc_charset = FcCharSetCreate ();

[-- Attachment #3: Type: text/plain, Size: 371 bytes --]



------------------------+-----------------------------------------------------
Christian Lynbech       | christian #\@ defun #\. dk
------------------------+-----------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ftfont.c seg fault problem
  2009-01-16 14:28 [PATCH] ftfont.c seg fault problem Lynbech Christian
@ 2009-01-19 12:13 ` Kenichi Handa
  2009-01-20  7:54   ` Lynbech Christian
  0 siblings, 1 reply; 3+ messages in thread
From: Kenichi Handa @ 2009-01-19 12:13 UTC (permalink / raw)
  To: Lynbech Christian; +Cc: emacs-devel

In article <ytqptz7z8gvc.fsf@uw000184.eu.tieto.com>, Lynbech Christian <christian.lynbech@tieto.com> writes:

> I have had a number of problems with recent updates of emacs 23
> segmentation faulting on me when trying to use the font backend and
> antialiased fonts.

> I am unsure exactly what is causing the problem. It works fine when I
> compile it on a rather freshly updated debian system but the problem
> hits when trying to build and run on my primary workstation which is a
> SuSE SLED 10 SP1 system with some additional software installed. In
> particular this system doesn't really have gtk+ 2.0 and fontconfig
> claims to be version 2.3.94 and I am enabling the font backend and is
> trying to use fancy anti-aliased fonts.

> The problem hits in src/ftfont.c (ftfont_lookup_cache). The attached
> patch seems to alleviate the problem, at least to the point where emacs
> stops segmentation faulting. Even if the problem ultimately is a
> unfortunate combination of old libraries, I believe the patch is
> innocent enough to warrant inclusion.

Thank you for the report.  It seems to be a bug of
fontconfig, but, as checking the return value of FcFontList
has no problem, I installed a slightly modified patch as
attached (i.e. there's no merit of having xassert here).

By the way, you wrote "a number of problems".  What else do
you observe?

---
Kenichi Handa
handa@m17n.org

+++ ftfont.c	19 Jan 2009 12:07:32 -0000	1.43
@@ -310,9 +310,10 @@
 				FC_INDEX, FcTypeInteger, index, NULL);
 	  objset = FcObjectSetBuild (FC_CHARSET, NULL);
 	  fontset = FcFontList (NULL, pat, objset);
-	  xassert (fontset && fontset->nfont > 0);
-	  if (FcPatternGetCharSet (fontset->fonts[0], FC_CHARSET, 0, &charset)
-	      == FcResultMatch)
+	  if (fontset && fontset->nfont > 0
+	      && (FcPatternGetCharSet (fontset->fonts[0], FC_CHARSET, 0,
+				       &charset)
+		  == FcResultMatch))
 	    cache_data->fc_charset = FcCharSetCopy (charset);
 	  else
 	    cache_data->fc_charset = FcCharSetCreate ();





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ftfont.c seg fault problem
  2009-01-19 12:13 ` Kenichi Handa
@ 2009-01-20  7:54   ` Lynbech Christian
  0 siblings, 0 replies; 3+ messages in thread
From: Lynbech Christian @ 2009-01-20  7:54 UTC (permalink / raw)
  To: emacs-devel

>>>>> "Kenichi" == Kenichi Handa <handa@m17n.org> writes:

>> I have had a number of problems with recent updates of emacs 23
>> segmentation faulting on me when trying to use the font backend and
>> antialiased fonts.

Kenichi> By the way, you wrote "a number of problems".  What else do
Kenichi> you observe?

That was mostly just a poor formulation. I think that what I meant was
that I have run into the segmentation fault across a number of emacs
updates when building on the old machine. Only now did I pull myself
together to investigate it; it probably was the same problem all along.


------------------------+-----------------------------------------------------
Christian Lynbech       | christian #\@ defun #\. dk
------------------------+-----------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-20  7:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-16 14:28 [PATCH] ftfont.c seg fault problem Lynbech Christian
2009-01-19 12:13 ` Kenichi Handa
2009-01-20  7:54   ` Lynbech Christian

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.