JetForMe
(Rick M)
1
I'm trying to add SDL2TTF to my SDL project. I've successfully called SDL2 functions that take C-strings, but now I'm trying to call a function in SDL_ttf now, and it's crashing in what apparently is a UTF8 sizing operation:
let font = TTF_OpenFont("Sans.ttf", 24)
let textColor = SDL_Color(r: 255, g: 255, b: 255, a: 255)
let text = TTF_RenderText_Solid(font, "Dec 10", textColor) // Segmentation fault on macOS
Thread 1 Queue : com.apple.main-thread (serial)
#0 0x00000001004ba87c in TTF_SizeUTF8_Internal ()
#1 0x00000001004bad2d in TTF_RenderUTF8_Solid ()
#2 0x00000001004bacbe in TTF_RenderText_Solid ()
#3 0x0000000100001f1e in InfoDisplay.run() at InfoDisplay.swift:43
#4 0x0000000100003800 in main at main.swift:6
#5 0x00007fff735fa3d5 in start ()
Any idea what might be happening in here? Thanks.
allevato
(Tony Allevato)
2
Are you sure it's the UTF-8 string passing that's causing the issue in this case? Could the font returned by TTF_OpenFont be invalid/nil?
JetForMe
(Rick M)
3
Ugh, I'm an idiot. I thought I had checked this but I hadn't. Let's fix that issue first. brb…