wxFont::GetFaceName() deletes the font handle
|Reported by:||aebailey82||Owned by:||VZ|
wxFont::GetFaceName() deletes the underlying HFONT. If the font is already used by any windows, those windows are redrawn with the default ugly System font.
wxFontRefData::GetFaceName() caches the retrieved name by calling SetFaceName(), which calls Free(), which calls ::DeleteObject(m_hFont).
The attached program demonstrates the problem. It shows up in my app when I open a configuration dialog that includes font pickers. At that point, any customizable fonts that were used are destroyed.
The only similar issue I found is ancient #960. At first glance I'd guess it's not related, but I'm not sure.
I don't know if the attached patch is kosher, but it fixes my problem by bypassing wxFontRefData::Free().