SFML community forums

Help => Graphics => Topic started by: lap1994 on November 08, 2009, 02:04:49 am

Title: Font segfault D:
Post by: lap1994 on November 08, 2009, 02:04:49 am
Hello, I added this code to my game

Code: [Select]
void draw_hud(){
    sf::String score, hp;
    std::stringstream ss;

    score.SetFont(cg->hud_font);
    hp.SetFont(cg->hud_font);

    ss << (int)cg->player.score;
    score.SetText(ss.str().c_str());

    ss.str("");
    ss << "%" << cg->player.hp;
    hp.SetText(ss.str().c_str());

    score.SetPosition(24,480-48);
    wnd.Draw(score);

    hp.SetPosition(400, 480-48);
    wnd.Draw(hp);
}


And now a segfault happens when I close the game D:
Call stack:
#0 08FEAFDA   igldev32!devProcessAttach() (C:\WINDOWS\system32\igldev32.dll:??)

I already checked, its that code that makes segfault happen.
Title: Font segfault D:
Post by: Laurent on November 08, 2009, 10:35:33 am
It's a know bug.

Two workarounds exist:
- never construct a sf::String with the default font (always pass yours directly to the constructor)
- use the static SFML libraries