Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Font segfault D:  (Read 2454 times)

0 Members and 2 Guests are viewing this topic.

lap1994

  • Newbie
  • *
  • Posts: 11
    • MSN Messenger - lap.1994@hotmail.com
    • View Profile
Font segfault D:
« 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.
Practice makes perfect.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Font segfault D:
« Reply #1 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
Laurent Gomila - SFML developer

 

anything