Page MenuHome

Font thumbnails crash to desktop
Closed, ResolvedPublic

Description

System Information
Operating system: WINDOWS 10
Graphics card: GTX 1070

Blender Version
Broken:
2.80 Beta 4a5e046c923f 2019-07-16 23:38

Worked: (optional) N/A (Issue has been around a while I do believe)

Short description of error
Scrolling though a large collection of fonts (with a weighted free rolling scroll wheel / mx master mouse) suddenly causes complete crash to desktop.

Exact steps for others to reproduce the error
create text object, change font in context menu / font panel, navigate to font folder / enable thumbnails and rapidly scroll through font list / sudden crash to desktop.

**note I have over 467 font families installed which could total many 1000's of files. Also reproduced this error on a different machine with Dual RTX 2080ti's / Windows 10 but it appeared a little more resilient, however, it eventually crashed to desktop too.

Event Timeline

Do you know a place where we can actually easily download that many fonts to try and reproduce this issue?

That is a tricky one, I could google around for a "free" font archive but I would hate to post here and link to any shadey archive of fonts, fonts require licensing unless they are blatantly CC open etc.. Other than that finding a free font site and downloading them manually would be the other solution, time consuming though..

Sebastian Parborg (zeddb) triaged this task as Needs Information from User priority.

Does it happen with duplicate files? IE if you have a font file and just copy it a 1000 times?

Great idea, just tested it by pointing blender at a folder on my desktop with 900 duplications of the font Arial and Interestingly enough there is no failure condition this time which has me thinking could I have a rogue/corrupt font on both my systems and if so doe's this mean that there is some kind of problem with Blenders thumbnail generator or some kind of font handling error checking? (wild guesses obviously)

When I get more time I will try and narrow this down to any specific fonts.

Probably related to T62887. So if you find which font crashes, let us know.

Alright, I decided to copy my entire fonts folder in alphabetical order into a new fonts folder on the desktop, tested after copying each letters worth and at the end of that process nothing at all. My entire windows/fonts folder is duplicated on my desktop and it works flawlessly.

So, I decided to delete all the fonts I had installed and so we just have the stock Windows 10 fonts left installed, again the system crashes to desktop the second I enable thumbnails. However, if I copy the fonts to another folder this problem does not occur!

I thought I would delete any font cache's in windows and see if it was anything around caching that might be causing an issue but it appeared to have no effect, still crashes.

I am currently at a loss as what I could try next, totally open to suggestions.

Can you build blender yourself? In that case you should be able to run it with a debugger and get a somewhat useful crash report.

I shall get set up so I can build blender, I'll report back when I have some more details..

Ok I don't want to take any ones time up unnecessarily so can somebody link or give brief instructions on what steps I need to do to some debugging? I have installed everything required to compile Blender, which I just tested and it's compiling fine from cmd line.

I think you should just be able to run it in debug mode in visual studio. Then it should print a backtrace and show where in the code the crash triggered.

Yeah that's working fine. Ok now what info do you require there is a whole heap of stuff, I'll leave it in it's Exception Thrown state and await some instruction.

Exception thrown: read access violation.
g was nullptr. occurred

Is this ok?

blender.exe!blf_kerning_cache_new(FontBLF * font) Line 99 C

	blender.exe!blf_font_ensure_ascii_kerning(FontBLF * font, const unsigned int kern_mode) Line 293	C
	blender.exe!blf_font_draw_buffer_ex(FontBLF * font, const unsigned char * str, unsigned __int64 len, ResultBLF * r_info, int pen_y) Line 519	C
	blender.exe!blf_font_draw_buffer(FontBLF * font, const unsigned char * str, unsigned __int64 len, ResultBLF * r_info) Line 651	C
	blender.exe!BLF_thumb_preview(const unsigned char * filename, const unsigned char * * draw_str, const unsigned char draw_str_lines, const float * font_color, const int font_size, unsigned char * buf, int w, int h, int channels) Line 122	C
	blender.exe!IMB_thumb_load_font(const unsigned char * filename, unsigned int x, unsigned int y) Line 73	C
	blender.exe!thumb_create_ex(const unsigned char * file_path, const unsigned char * uri, const unsigned char * thumb, const bool use_hash, const unsigned char * hash, const unsigned char * blen_group, const unsigned char * blen_id, ThumbSize size, ThumbSource source, ImBuf * img) Line 472	C
	blender.exe!thumb_create_or_fail(const unsigned char * file_path, const unsigned char * uri, const unsigned char * thumb, const bool use_hash, const unsigned char * hash, const unsigned char * blen_group, const unsigned char * blen_id, ThumbSize size, ThumbSource source) Line 573	C
	blender.exe!IMB_thumb_manage(const unsigned char * org_path, ThumbSize size, ThumbSource source) Line 734	C
	blender.exe!filelist_cache_preview_runf(TaskPool * pool, void * taskdata, int UNUSED_threadid) Line 1198	C
	blender.exe!task_scheduler_thread_run(void * thread_p) Line 451	C
	[External Code]	
	blender.exe!invoke_thread_procedure(unsigned int(*)(void *) procedure, void * const context) Line 92	C++
	blender.exe!thread_start<unsigned int (__cdecl*)(void * __ptr64)>(void * const parameter) Line 115	C++
	[External Code]

Ok, so if you open the source/blender/blenfont/intern/blf_glyph.c file (line 99) add g && to the if statment:

if (g && g_prev && FT_Get_Kerning(font->face, g_prev->idx, g->idx, kc->mode, &delta) == 0) {

Does it still crash when you recompile and run it again?

No crash! Working nicely now. Brill. Thanks Sebastian. So I take it your next step is to make an alteration to the code and submit that for inclusion? I have not coded for decades and that was ASM way back. This OO stuff and GIT is currently outside of my scope of understanding.

Sebastian Parborg (zeddb) raised the priority of this task from Needs Information from User to Normal.

I can commit the change, no worries. Thanks for taking the time to debug this. You are now a blender developer, kinda. ;)

Great. This was a really positive experience. Have a good one 👍