SFML community forums

Help => Graphics => Topic started by: Groogy on January 19, 2009, 10:13:12 pm

Title: sf::Text destructor crashes app
Post by: Groogy on January 19, 2009, 10:13:12 pm
It's probably me that has done something wrong. But every time I try to run my application with sf::String it crashes when it shuts down(working perfectly until then). When I uncomment the line where I create the object the error disappears.

Can't see what's wrong.
Title: sf::Text destructor crashes app
Post by: Beliar on January 19, 2009, 10:42:35 pm
Since it crashes for me at the end too sometimes i tested it with sf::String and SFML.Graphics.String2D from SFML.net and both times the program crashes at then end once i have a variable of that type in it.
Title: sf::Text destructor crashes app
Post by: Groogy on January 19, 2009, 10:45:25 pm
I don't know much of the internal functions of the library.

But I'm working at Windows at the moment, but it feels like I would get a SEGMENTATION FAULT if I would have done this in Linux. So my guess is that somewhere we tries to dealloc NULL or something.
Title: sf::Text destructor crashes app
Post by: Laurent on January 19, 2009, 10:48:04 pm
It happens when the default font is destroyed (so it won't happen if it doesn't get instanciated).

I've already worked hard on this issue, and I have no clue so far :(
Title: sf::Text destructor crashes app
Post by: Groogy on January 19, 2009, 10:52:50 pm
Your sure it's the font? Since It happens when the String is removed? I'll have a look at the source code and see If I can find anything.

Does this happen for everyone or is it isolated?
Title: sf::Text destructor crashes app
Post by: Groogy on January 19, 2009, 11:10:21 pm
Hmm you don't have a destructor for either classes. Couldn't be that the default destructor is messing something up? Though I can't think of a reason why it would.

I'll put some cout here and there and see if I can narrow down the error.
Title: sf::Text destructor crashes app
Post by: Groogy on January 19, 2009, 11:42:00 pm
Wierd thing, you said the default font did it? I told my sf::String object to use another font with: "text.SetFont(font);" but I still get the same thing.
Do I have to use the constructor to avoid the error?
Title: sf::Text destructor crashes app
Post by: Laurent on January 20, 2009, 07:52:45 am
Quote
Do I have to use the constructor to avoid the error?

Yes, because the constructor instanciates the default font in case you don't specify another one.