Page MenuHome

Fix for crash when selecting an invalid font
Closed, ArchivedPublicPATCH

Description

This patch (hopefully) prevents Blender from crashing when picking an invalid international font.

Steps to reproduce:
* Start Blender
* Go the User Preferences
* Select Language & Font
* Enable International Fonts
* Click Select Font button
* In the file browser, immediately click LOAD UI FONT
* Observe that Blender crashes

The crash is essentially a null pointer reference, caused by the FTF_TTFont class dropping (and NULL-ing) pointers to versions of the current font, before trying to load the new one. As the load fails, those pointers are left at NULL, which causes subsequent accesses to do bad things.

The attached patch simply defers this pointer-clearing until the font is known to have loaded. I introduced a new method (DeleteSizes(), to reduce code duplication).

Comments welcome, of course.

Event Timeline

Kent Mein (sirdude) changed the task status from Unknown Status to Unknown Status.Jun 23 2006, 5:31 PM