First of all, apologies if this thread is only for SDL and not for the other
libraries.
Okay, so I’m doing some tests of the GUI I’m developing for my game, and I run
into an annoying little problem. Seems like every once in a while, upon exiting
the program, I get a “Send error report to Microsoft” error window stating that
the error occurred in “sdl_ttf.dll”. I eventually track it down and figure out
what exactly is causing the problem.
You see, I have some text field controls, and apparently whenever I have to
render a captial ‘M’ for one, this little error occurs. I experimented some more
and just made the TTF_RenderText_Blended() call output just a letter “M” and not
what was actually stored in the text field, and it still happens, which means
that it’s not keypresses or my handling code, it’s the Render call. I also tried
Solid(), and it still does the same thing.
Then I tried taking out all the text controls but one, and this does not make
an error upon exiting, which would lead me to conclude that some pointer is
getting deleted in one of them before the other is done with it. The only such
pointer I have is a TTF_Font*, which each text control has. Upon instantiation,
each one opens a new Courier New font, and in the destructor, the font is closed
and NULL’ed.
The behavior of my program upon exit would lead me to believe that only one
TTF_Font* can be opened per .ttf file, but I can’t find anything in the SDL_TTF
docs that supports that theory or issues a warning about that. Also, if this
were the case, would it not popup an error after any use of multiple text
controls in the program, and not just when a capital ‘M’ is rendered?