This repository was archived by the owner on Mar 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 173
Memory corruption due to ellipsed text when using Pango #722
Comments
Using valgrind we managed to track this issue down to thread-unsafe usage of font caches. Pango is thread safe in this regard by keeping a font cache per thread. Libgdiplus however sends a global font cache to Pango resulting in use after free issues. This case can be fixed by replacing the usage of Here's an example of the valgrind output:
|
I think the custom font map is there to support user-loaded fonts. We would likely need to add locks around the Pango calls. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Reproducible example: https://github.com/handerss-tibco/libgdiplus-pango-memory-corruption
There are memory corruption issues when performing
MeasureString
on multiple threads if measurement uses ellipsed text. This corruption error only occurs when libgdiplus is compiled with pango as the backend. Here's a minimal reproducible example:This program produces a number of warnings/criticals:
These issues are only observed when multiple threads are used, and when libgdiplus is compiled with pango backend. We also observe these issues when compiling libgdiplus from
main
and using a new version of Pango 1.46.2 (Debian 11).The text was updated successfully, but these errors were encountered: