From bcff137f866fcb05141cc07c82c2e2be3b671213 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Fri, 22 Sep 2006 13:21:06 -0400 Subject: [PATCH] Support for FontConfig 2.4 Changes in the memory dessalocation scheme of FC structures to accomodate FC 2.4 series. Thanks to Alberto Diaz and Stephane Duverger for their assistance during the debugging process. --- configure.ac | 15 +++++++++++++-- src/xwindow.c | 12 ++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 0158ca7..016d3ef 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -dnl Initialize autoconf and automake +nl Initialize autoconf and automake AC_INIT AC_CONFIG_SRCDIR(src/main.c) AC_PREREQ(2.52) @@ -428,7 +428,18 @@ AC_TRY_LINK( #include , FcInit(), AC_MSG_RESULT([yes]) -AC_DEFINE(HAVE_FONTCONFIG_FONTCONFIG_H,1,[Define to 1 if you have the header file.]), +AC_DEFINE(HAVE_FONTCONFIG_FONTCONFIG_H,1,[Define to 1 if you have the header file.]) + +AC_MSG_CHECKING([For fontconfig FcFini()]) +AC_TRY_LINK( +#include +, FcFini(), +AC_MSG_RESULT([yes]) +AC_DEFINE(HAVE_FONTCONFIG_FCFINI,1,[Define to 1 if FcFini() call exists]) +, +AC_MSG_RESULT([no])) + +, AC_MSG_RESULT([no]) FONTCONFIG_LIBS= FONTCONFIG_CFLAGS= diff --git a/src/xwindow.c b/src/xwindow.c index 5000ea3..12ec3bd 100644 --- a/src/xwindow.c +++ b/src/xwindow.c @@ -123,9 +123,17 @@ xwindow_locate_truetype_fonts(void) if ((strlen((char*)file)>4) && (strstr((char*)file+strlen((char*)file)-4,".ttf"))) imlib_add_path_to_font_path(dirname((char*)file)); - FcFontSetDestroy(fs); - FcObjectSetDestroy(os); } +#ifdef HAVE_FONTCONFIG_FCFINI + FcFini(); +#else + /* On FontConfig >= 2.4, this causes a segfault, probably due to the new + caching mechanism: we don't have to care, since FcFini() always exists, + and does the dirty dessalocation job just fine. + */ + if (fs) FcFontSetDestroy(fs); + FcObjectSetDestroy(os); +#endif } #endif imlib_add_path_to_font_path("."); -- 2.11.4.GIT