Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • F fontconfig
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 182
    • Issues 182
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 23
    • Merge requests 23
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • fontconfig
  • fontconfig
  • Issues
  • #161
Closed
Open
Issue created Jun 06, 2019 by std4453@std4453

FcFini() sends SIGABRT when using Xft

When using Xft and fontconfig, calling FcFini() after creating XftFonts with XftFontOpen*() causes SIGABRT to be thrown and jamming the program, even after all created XftFonts have been closed with XftFontClose().

Example code:

#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
#include <fontconfig/fontconfig.h>

int main() {
  FcInit();

  Display *dis = XOpenDisplay(NULL);
  int screen = DefaultScreen(dis);
  XftFont *f = XftFontOpenName(dis, screen, "sans-serif");
  XftFontClose(dis, f);

  FcFini();
}

Compile with:

gcc main.c -lfontconfig -lfreetype -lX11 -lXft

And executing it outputs:

$ ./a.out
a.out: fccache.c:525: FcCacheFini: Assertion `fcCacheChains[i] == NULL' failed.
Aborted (core dumped)

And valgrind reports:

==11600== 128 bytes in 1 blocks are definitely lost in loss record 111 of 158
==11600==    at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==11600==    by 0x4E48493: ??? (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.8.0)
==11600==    by 0x4E441EC: FcConfigSubstituteWithPat (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.8.0)
==11600==    by 0x566FCA9: XftFontMatch (in /usr/lib/x86_64-linux-gnu/libXft.so.2.3.2)
==11600==    by 0x566FFD6: XftFontOpenName (in /usr/lib/x86_64-linux-gnu/libXft.so.2.3.2)
==11600==    by 0x1088A8: main (in /tmp/test/a.out)
==11600== 
==11600== 352 (256 direct, 96 indirect) bytes in 1 blocks are definitely lost in loss record 127 of 158
==11600==    at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==11600==    by 0x4E550F9: ??? (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.8.0)
==11600==    by 0x4E55861: ??? (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.8.0)
==11600==    by 0x4E55C1B: FcPatternAddDouble (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.8.0)
==11600==    by 0x566C4CD: ??? (in /usr/lib/x86_64-linux-gnu/libXft.so.2.3.2)
==11600==    by 0x566C7C4: ??? (in /usr/lib/x86_64-linux-gnu/libXft.so.2.3.2)
==11600==    by 0x566CA33: ??? (in /usr/lib/x86_64-linux-gnu/libXft.so.2.3.2)
==11600==    by 0x566CE8D: XftDefaultHasRender (in /usr/lib/x86_64-linux-gnu/libXft.so.2.3.2)
==11600==    by 0x566D2B7: XftDefaultSubstitute (in /usr/lib/x86_64-linux-gnu/libXft.so.2.3.2)
==11600==    by 0x566FCC4: XftFontMatch (in /usr/lib/x86_64-linux-gnu/libXft.so.2.3.2)
==11600==    by 0x566FFD6: XftFontOpenName (in /usr/lib/x86_64-linux-gnu/libXft.so.2.3.2)
==11600==    by 0x1088A8: main (in /tmp/test/a.out)
==11600== 
==11600== 2,603 (768 direct, 1,835 indirect) bytes in 1 blocks are definitely lost in loss record 149 of 158
==11600==    at 0x4C2DDCF: realloc (vg_replace_malloc.c:785)
==11600==    by 0x4E5504A: ??? (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.8.0)
==11600==    by 0x4E55741: ??? (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.8.0)
==11600==    by 0x4E528D8: FcFontRenderPrepare (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.8.0)
==11600==    by 0x4E52C3F: FcFontMatch (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.8.0)
==11600==    by 0x566FCDA: XftFontMatch (in /usr/lib/x86_64-linux-gnu/libXft.so.2.3.2)
==11600==    by 0x566FFD6: XftFontOpenName (in /usr/lib/x86_64-linux-gnu/libXft.so.2.3.2)
==11600==    by 0x1088A8: main (in /tmp/test/a.out)
==11600== 
==11600== LEAK SUMMARY:
==11600==    definitely lost: 1,152 bytes in 3 blocks
==11600==    indirectly lost: 1,931 bytes in 59 blocks
==11600==      possibly lost: 0 bytes in 0 blocks
==11600==    still reachable: 201,717 bytes in 534 blocks
==11600==         suppressed: 0 bytes in 0 blocks

I wonder whether I'm using FcInit() and FcFini() right? How does Xft interact with fontconfig? Or is the problem actually one of fontconfig's?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking