[cairo-bugs] [Bug 106967] New: cairo_ft_font_face_create_for_ft_face causes segmentation fault
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Tue Jun 19 19:23:54 UTC 2018
https://bugs.freedesktop.org/show_bug.cgi?id=106967
Bug ID: 106967
Summary: cairo_ft_font_face_create_for_ft_face causes
segmentation fault
Product: cairo
Version: 1.12.14
Hardware: x86-64 (AMD64)
OS: Windows (All)
Status: NEW
Severity: normal
Priority: medium
Component: freetype font backend
Assignee: david at freetype.org
Reporter: longfeiqiu2012 at gmail.com
QA Contact: cairo-bugs at cairographics.org
I am using cairo on MinGW-w64, Windows 10. The following code produces a crash:
#include <ft2build.h>
#include <cairo/cairo.h>
#include <cairo/cairo-ft.h>
int main(){
FT_Library ft;
FT_Face textFont;
cairo_font_face_t *cairoFont;
FT_Init_FreeType(&ft);
FT_New_Face(ft,"Hack-Regular.ttf",0,&textFont);
cairoFont = cairo_ft_font_face_create_for_ft_face(textFont,0); // This line
produces segmentation fault
return 0;
}
The problem seems to be that EnterCriticalSection is called before
InitializeCriticalSection. A quick workaround is to initialize it manually:
#include <ft2build.h>
#include <cairo/cairo.h>
#include <cairo/cairo-ft.h>
extern "C" void _cairo_mutex_initialize();
int main(){
FT_Library ft;
FT_Face textFont;
cairo_font_face_t *cairoFont;
FT_Init_FreeType(&ft);
FT_New_Face(ft,"Hack-Regular.ttf",0,&textFont);
_cairo_mutex_initialize(); //This eliminates the segfault
cairoFont = cairo_ft_font_face_create_for_ft_face(textFont,0);
return 0;
}
--
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo-bugs/attachments/20180619/acf3029c/attachment.html>
More information about the cairo-bugs
mailing list