Advertisement

TTF_CloseFont() Segmentation Fault

Started by September 15, 2016 03:44 PM
2 comments, last by rip-off 8 years, 2 months ago
Here's the code: https://github.com/Nyapp/Cell/blob/master/src/engine_classes.h
The TTF_CloseFont() that I'm having trouble with is in Text::~Text(). When I close the game, I get a segfault. What am I doing wrong?

You are probably deleting/closing the font twice. Segmentation faults generally occur upon trying to dereference invalid pointers, or similar.

Set a breakpoint in the destructor and verify that your font is a valid address.

If you have TTF_CloseFont() somewhere else, put breakpoints there as well.

Hello to all my stalkers.

Advertisement

Check you aren't deleting text that has already been deleted too.

Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.

Classes should obey the Rule of Three. Anytime you add a destructor to a class, think about whether to handle copying instances of that class, or else make the class as noncopyable.

This topic is closed to new replies.

Advertisement