Crash when text is drawn using XFT fonts the second time with a new display connection in the same application process
Submitted by TheD
Assigned to Xorg Project Team
Description
Created attachment 103127 Code with which the crash is reproducible
I was trying to use XFT for my application, but it crashes the second time I try to draw the text with a new display connection inside the same process. The following is simplified version of my use case.
while true
do
OpenDisplay
LoadFont
Draw Text
Close Font
Close Display
end
I read in a few forums that XCloseDisplay will also close the fonts, but I noticed memory leak when I tried that with multiple fonts loaded.
I tried to debug the issue and these were my observations,
- Comment XftDrawText, crash disappears
- Comment XftFontClose, crash disappears but leaks memory
- Hooked up the debugger and noticed that the crash was in _XftDisplayInfoGet(), specifically when XRenderFindVisualFormat() is called.
I have attached the code with which the crash is reproducible.
Thanks
Attachment 103127, "Code with which the crash is reproducible":
textTest.cpp