Intermittent assert firing in ImFontAtlasBuildWithFreeTypeEx #7630
Replies: 3 comments
-
Are you passing in custom glyph ranges? If so, make sure they are in memory for which you control the lifetime, aka not in the stack at the point of calling AddFont functions. |
Beta Was this translation helpful? Give feedback.
-
Im loading custom fonts if thats what you mean? Assuming it is, I load them from resources where I allocate and free the memory around the AddFontX calls like this: I presume you mean I need to hold onto this memory until after I build the fonts? I dont think I add the fonts in a different thread to building them but I should double check that as its the most likely cause of this if they are. |
Beta Was this translation helpful? Give feedback.
-
Ah hang on there's that constexpr array with icon ranges in it maybe thats the problem! I thought constexpr stuff doesn't sit on the stack though, hmm I guess it does. I'll move it and see if it fixes my issue. Thanks! ImGui is totally amazing by the way - I hope to give back at some point but a massive thank you in the mean time. |
Beta Was this translation helpful? Give feedback.
-
Hi I have an intermittent assert firing in ImFontAtlasBuildWithFreeTypeEx. Normally its fine it just asserts every so often booting into my application on this line:
if (dst_tmp.GlyphsSet.TestBit(codepoint)) // Don't overwrite existing glyphs. We could make this an option (e.g. MergeOverwrite)
with this assert:
bool TestBit(int n) const { IM_ASSERT(n < (Storage.Size << 5)); return IM_BITARRAY_TESTBIT(Storage.Data, n); }
With a seemingly incorrect codepoint value of 0x0000f1e0 but I'm a little lost as to why that is. It feels like this is a race condition, but it could be a memory stomp (or probably a race condition leading to a memory stomp).
Anybody come across anything like this?
I think it started when I upgraded to dear imgui, v1.90.4 before that it was fine with the same fonts I'm loading - off the top of my head I couldn't tell you the previous version of imgui when it worked though (I can find out though if its required).
Beta Was this translation helpful? Give feedback.
All reactions